/*
 * Материалууд: its own marketplace look (owner 2026-10-21), not House3D's
 * CAD one. Mobile first: one column, the filters folded behind a button,
 * two cards across; wider screens add the sidebar and more columns.
 */

:root {
	--bg: #f4f5f7;
	--card: #ffffff;
	--ink: #101828;
	--muted: #5b6474;
	--line: #e4e7ec;
	--line-soft: #f0f1f3;
	--accent: #c2410c;          /* 5.2:1 with white text */
	--accent-strong: #9a3412;
	--accent-wash: #fff1e6;
	--accent-line: #fed7aa;
	--ok: #085d3a;
	--ok-wash: #e7f6ee;
	--warn: #93370d;
	--warn-wash: #fef0c7;
	--info: #1d3a8a;
	--info-wash: #eef4ff;
	--tile: #eef0f3;
	--radius: 14px;
	--radius-s: 10px;
	color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 15px/1.45 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; }
h2 { margin: 0 0 10px; font-size: 18px; font-weight: 700; }
.vis { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- header ---------------------------------------------------------------- */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 17px; }
.brand-text span { font-size: 12px; color: var(--muted); }
.top-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.search { position: relative; order: 3; flex: 1 1 100%; display: flex; height: 46px; border: 2px solid var(--ink); border-radius: 12px; background: var(--card); }
.search input { flex: 1; min-width: 0; border: 0; padding: 0 14px; font: inherit; font-size: 16px; background: transparent; border-radius: 12px 0 0 12px; }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--accent); }
.search button { display: flex; align-items: center; gap: 8px; padding: 0 16px; border: 0; background: var(--ink); color: #fff; font: inherit; font-weight: 600; border-radius: 0 9px 9px 0; cursor: pointer; }
.search button span { display: none; }
.suggest { position: absolute; left: -2px; right: -2px; top: 50px; z-index: 20; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px rgb(16 24 40 / 16%); padding: 6px; max-height: 70vh; overflow-y: auto; }
.suggest-group { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.suggest a { display: flex; gap: 8px; align-items: center; min-height: 44px; padding: 6px 10px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; }
.suggest a:hover, .suggest a[aria-selected="true"] { background: var(--accent-wash); }
.suggest a small { margin-left: auto; color: var(--muted); }
.suggest .suggest-all { font-weight: 600; color: var(--accent); border-top: 1px solid var(--line-soft); border-radius: 0; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }

/* --- chips and pills -------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 14px; text-decoration: none; white-space: nowrap; }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-on:hover { color: #fff; }
.chip-active { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent-strong); }
.chip small { color: var(--muted); }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; }
.chip-check:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-check:has(input:checked) small { color: #d0d5dd; }
.chip-check:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.pill-ok { background: var(--ok-wash); color: var(--ok); }
.pill-warn { background: var(--warn-wash); color: var(--warn); }
.pill-info { background: var(--info-wash); color: var(--info); }
.pill-none { background: var(--tile); color: #344054; }

/* --- buttons ---------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

/* --- page --------------------------------------------------------------------- */
.page { padding-top: 16px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 14px; }
.crumbs { font-size: 13px; color: var(--muted); }
.heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.section-title { margin-top: 10px; }
.hero { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 22px 18px; }
.hero h1 { font-size: 24px; }
.hero p { margin: 8px 0 0; color: #d0d5dd; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 4px; min-height: 76px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.tile span { color: var(--muted); font-size: 13px; }
.tile:hover { border-color: var(--accent); color: var(--ink); }
.empty { padding: 30px 16px; text-align: center; background: var(--card); border-radius: var(--radius); color: var(--muted); }
.foot { padding: 20px 0 32px; color: var(--muted); font-size: 13px; text-align: center; }

/* --- listing ------------------------------------------------------------------- */
.listing { display: flex; flex-direction: column; gap: 14px; }
.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.filters > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px; font-weight: 600; cursor: pointer; }
.filters > summary::after { content: '▾'; color: var(--muted); }
.filters[open] > summary::after { content: '▴'; }
.filters > summary::-webkit-details-marker { display: none; }
.filters-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.box { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.box legend { float: left; width: 100%; margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.box legend + * { clear: both; }
.box h2 { font-size: 17px; }
.tree-head { margin: 8px 0 2px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.check span { flex: 1; }
.check small { color: var(--muted); }
.range { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.range input { width: 100%; min-width: 0; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-s); font: inherit; font-size: 16px; }
.chips { clear: both; display: flex; flex-wrap: wrap; gap: 6px; }
.filters-actions { display: flex; gap: 8px; }
.filters-actions .btn { flex: 1; }
.results { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.active { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.toolbar label { display: flex; align-items: center; gap: 6px; }
.toolbar select { height: 40px; border: 1px solid var(--line); border-radius: var(--radius-s); font: inherit; font-size: 15px; color: var(--ink); background: var(--card); padding: 0 8px; }
.views { margin-left: auto; display: flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--card); }
.views a { display: grid; place-items: center; width: 44px; height: 40px; color: var(--ink); text-decoration: none; }
.views a.on { background: var(--ink); color: #fff; }

/* --- cards --------------------------------------------------------------------- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card a { height: 100%; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; }
.card a:hover { border-color: var(--accent); color: var(--ink); }
.card-photo { position: relative; aspect-ratio: 1 / 1; background: var(--tile); color: #98a2b3; display: grid; place-items: center; }
.card-photos { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; background: rgb(16 24 40 / 72%); color: #fff; font-size: 11px; }
.card-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 10px; }
.price { font-size: 17px; font-weight: 700; }
.price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.price-ask { font-size: 14px; font-weight: 600; color: var(--muted); }
.card-name { font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.card-spec { font-size: 12px; color: var(--muted); }
.card-foot { margin-top: auto; width: 100%; padding-top: 8px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.card-foot span:last-child { white-space: nowrap; }

/* the list view: one row per product */
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rows .card a { flex-direction: row; }
.rows .card-photo { flex: 0 0 96px; aspect-ratio: auto; }
.rows .card-photos { display: none; }

.pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.pages-gap { align-self: center; color: var(--muted); }

/* --- Vendors ------------------------------------------------------------------- */
.avatar { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.avatar-big { width: 72px; height: 72px; border-radius: 18px; font-size: 18px; background: #fff; color: var(--ink); }
.vendor-hit { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.vendor-hit:hover { border-color: var(--accent); color: var(--ink); }
.vendor-hit { flex-wrap: wrap; }
.vendor-hit-text { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; }
.vendor-hit-text span { font-size: 13px; color: var(--muted); }
.vendor-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.vendor-head { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 18px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.vendor-info { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.vendor-info p { margin: 0; color: #d0d5dd; }
.vendor-links { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; }
.vendor-links .btn:not(.btn-primary) { background: transparent; color: #fff; border-color: #475467; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; }
.link-row .btn { flex: 1; }

/* --- product ------------------------------------------------------------------ */
.product { display: flex; flex-direction: column; gap: 16px; }
.gallery-main { aspect-ratio: 4 / 3; border-radius: 16px; background: var(--tile); color: #98a2b3; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; }
.gallery-main span { color: var(--muted); font-size: 14px; }
.buy { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.buy h1 { font-size: 24px; }
.buy p { margin: 0; }
.price-box { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.price-big { font-size: 28px; }
.actions { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.buy .vendor-hit { width: 100%; }
.product-more { display: flex; flex-direction: column; gap: 14px; }
.specs { margin: 0; }
.specs div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; text-align: right; font-weight: 500; }
.specs dd.missing { color: var(--warn); font-weight: 400; }
.caps { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.caps li { display: flex; gap: 10px; align-items: flex-start; }
.caps .pill { flex: none; min-width: 84px; text-align: center; }

/* --- wider screens ------------------------------------------------------------- */
@media (min-width: 640px) {
	.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
	.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.search button span { display: inline; }
	.actions { flex-direction: row; }
	.actions .btn { flex: 1; }
	.vendor-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
	.wrap { padding: 0 20px; }
	.search { order: 0; flex: 1 1 420px; }
	.brand { margin-right: 0; }
	h1 { font-size: 26px; }
	.hero { padding: 32px; }
	.hero h1 { font-size: 30px; }
	.tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
	.listing { flex-direction: row; align-items: flex-start; gap: 20px; }
	.filters { flex: 0 0 280px; background: none; border: 0; }
	.filters > summary { display: none; }
	.filters-body { padding: 0; }
	.results { flex: 1; }
	.grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.rows .card-photo { flex-basis: 120px; }
	.product { flex-direction: row; align-items: flex-start; gap: 28px; }
	.gallery { flex: 1 1 520px; max-width: 560px; }
	.buy { flex: 1 1 400px; }
	.buy h1 { font-size: 30px; }
	.product-more { flex-direction: row; align-items: flex-start; }
	.product-more .box { flex: 1; }
	.vendor-head { padding: 28px; align-items: center; }
	.vendor-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- the back office --------------------------------------------------------- */
.op-top { background: var(--ink); color: #fff; }
.brand-dark, .brand-dark:hover { color: #fff; }
.brand-dark .brand-text span { color: #d0d5dd; }
.op-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.op-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius-s); color: #eaecf0; text-decoration: none; }
.op-nav a:hover { background: #344054; color: #fff; }
.flash { margin: 0; padding: 12px 14px; border-radius: var(--radius-s); font-weight: 500; }
.flash-ok { background: var(--ok-wash); color: var(--ok); }
.flash-bad { background: #fee4e2; color: #912018; }
.center { text-align: center; }
.stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stats li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; }
.stats span { font-size: 13px; color: var(--muted); }
.stats b { font-size: 24px; }
.op-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.op-filter input[type="search"], .op-filter select { flex: 1 1 200px; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-s); font: inherit; font-size: 16px; background: var(--card); }
.table-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.op-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14px; }
.op-table th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 500; color: var(--muted); }
.op-table td { padding: 10px 12px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.op-table td input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.sub { display: block; font-size: 12px; color: var(--muted); }
.op-cols { display: flex; flex-direction: column; gap: 14px; }
.op-side { display: flex; flex-direction: column; gap: 14px; }
.op-form { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.op-form h2 { margin: 8px 0 0; }
.op-form > .btn { align-self: flex-start; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: #344054; min-width: 0; }
.field input, .field select, .op-form textarea, .batch input { height: 44px; padding: 0 12px; border: 1px solid #d0d5dd; border-radius: var(--radius-s); font: inherit; font-size: 16px; font-weight: 400; color: var(--ink); background: #fff; width: 100%; }
.op-form textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field small { font-weight: 400; color: var(--muted); }
.field input:invalid:not(:placeholder-shown) { border-color: #d92d20; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.notes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.notes li { background: var(--bg); border-radius: var(--radius-s); padding: 10px; }
.batch { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.batch input { flex: 1 1 200px; width: auto; }
.offer-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: end; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.offer-row h3 { grid-column: 1 / -1; margin: 0; font-size: 15px; }
@media (min-width: 960px) {
	.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.op-cols { flex-direction: row; align-items: flex-start; }
	.op-cols > .op-form { flex: 3; }
	.op-cols > * { flex: 2; }
	.offer-row { grid-template-columns: 1.2fr 0.8fr 1.2fr 1fr 1fr auto; }
}

/* --- photos -------------------------------------------------------------------- */
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.rows .card-photo img { position: absolute; inset: 0; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; border-radius: 16px; background: var(--tile); }
.thumbs { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.thumbs a { display: block; aspect-ratio: 1 / 1; border-radius: var(--radius-s); overflow: hidden; border: 2px solid transparent; background: var(--tile); }
.thumbs a[aria-current="true"] { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.photo-grid li { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.photo-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-s); background: var(--tile); }
.photo-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-actions .btn { min-height: 38px; padding: 0 12px; font-size: 13px; }
.photo-upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (min-width: 960px) { .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* --- the Vendor console ------------------------------------------------------- */
.con-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.con-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; font-weight: 500; }
.con-nav a:hover { background: var(--accent-wash); color: var(--accent-strong); }
.top-nav .top-cta { margin-left: 4px; padding: 0 14px; border-radius: 10px; background: var(--accent-wash); color: var(--accent-strong); font-weight: 600; }
.flash-info { background: var(--info-wash); color: var(--info); font-weight: 400; }
.con-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.con-item { display: flex; flex-direction: column; gap: 6px; }
.con-item-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.con-item-head a { color: var(--ink); text-decoration: none; }
.warn-text { color: var(--warn); }
.price-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; margin-top: 6px; }
.price-form .btn, .price-form .check { grid-column: 1 / -1; }
.narrow { max-width: 640px; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; }
.decide { margin-top: 6px; }
fieldset.field { border: 0; padding: 0; margin: 0; }
@media (min-width: 960px) {
	.price-form { grid-template-columns: 1.2fr 1fr 1fr auto; }
	.price-form .btn { grid-column: auto; }
}
