:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1d2320;
  --muted: #6b716d;
  --line: #e3e0d8;
  --accent: #2f5d50;
  --accent-2: #e8f0ec;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --cost: #d0021b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
code { background: var(--accent-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.topsearch { flex: 1; display: flex; max-width: 760px; }
.topsearch input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 10px 14px; border: 1px solid var(--line);
  border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--bg); outline: none;
}
.topsearch input:focus { border-color: var(--accent); background: #fff; }
.topsearch button { border: 0; background: var(--accent); color: #fff; padding: 0 16px; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; }
.mainnav { display: flex; gap: 4px; }
.mainnav a { padding: 8px 11px; border-radius: 8px; color: var(--text); font-weight: 500; white-space: nowrap; }
.mainnav a:hover, .mainnav a.on { background: var(--accent-2); text-decoration: none; }
.sl-count { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 2px; }
.main { padding: 20px 24px 40px; max-width: 1600px; margin: 0 auto; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

/* ---------- buttons, forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 500; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 4px 9px; font-size: 13px; }
input[type=number], input[type=text], input[type=password], input[type=search], select {
  font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; min-width: 0;
}
.ok { background: var(--accent-2); color: var(--accent); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.err { background: #fde8e8; color: #a40000; padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.note { background: var(--warn-bg); color: var(--warn); padding: 9px 13px; border-radius: 8px; margin: 8px 0 14px; font-size: 14px; }
.tag { display: inline-block; background: var(--accent-2); color: var(--accent); border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.extra { background: #eef0f6; color: #3c4a7a; }
.chip { display: inline-block; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 3px 11px; margin: 2px 4px 2px 0; font-size: 13px; color: var(--text); }
.chip em { color: var(--muted); font-style: normal; }
.page-title { font-size: 26px; letter-spacing: -.01em; }
.sub { font-size: 19px; margin-top: 28px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

/* ---------- search ---------- */
.search-layout { display: grid; grid-template-columns: 270px 1fr; gap: 24px; align-items: start; }
.filters { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.filters-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.filters-head .clear { margin-left: auto; font-size: 13px; }
.close-filters { display: none; }
.fgroup { border-top: 1px solid var(--line); padding: 8px 0; }
.fgroup summary { cursor: pointer; font-weight: 600; padding: 4px 0; list-style: none; }
.fgroup summary::-webkit-details-marker { display: none; }
.fgroup summary::after { content: "▾"; float: right; color: var(--muted); }
.fgroup:not([open]) summary::after { content: "▸"; }
.tgroup { margin: 4px 0 6px; }
.tg-name { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 2px; }
.chk { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-size: 14px; cursor: pointer; }
.chk .n { margin-left: auto; color: var(--muted); font-size: 12px; }
.extra-chk { margin-top: 6px; font-size: 13px; color: var(--muted); }
.range { display: grid; grid-template-columns: 82px 1fr 10px 1fr; gap: 5px; align-items: center; margin: 5px 0; font-size: 13px; }
.range select { grid-column: 2 / span 3; }
.range .dash { text-align: center; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 0; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 16px; padding: 3px 10px; font-size: 13px; cursor: pointer; background: #fff; }
.pill em { color: var(--muted); font-style: normal; font-size: 11px; }
.pill input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill input:checked + span em { color: #d9e6e0; }
.pills.static .pill span { cursor: default; }
.sw { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); display: inline-block; }
.sw-white { background: #fff; } .sw-black { background: #1b1b1b; } .sw-grey { background: #8d9190; }
.sw-beige { background: #d8c9ad; } .sw-brown { background: #7a5233; } .sw-green { background: #5b7b4d; }
.sw-blue { background: #3d6aa3; } .sw-red { background: #b4462f; } .sw-yellow { background: #e0a526; } .sw-pink { background: #c77fa6; }
.apply { width: 100%; justify-content: center; margin-top: 10px; }
.js .apply { display: none; }

.results-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.results-head .count { font-size: 15px; }
.sortform { margin-left: auto; font-size: 14px; color: var(--muted); }
.open-filters { display: none; }
.understood { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.understood .chip { background: var(--accent-2); border-color: transparent; color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.grid.mini { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s; }
.card:hover { box-shadow: var(--shadow); }
.card-img { position: relative; display: block; aspect-ratio: 4 / 3; background: #fff; border-bottom: 1px solid var(--line); }
.card-img img { width: 100%; height: 100%; object-fit: contain; padding: 8px; max-width: var(--mw, 100%); margin: 0 auto; }
.card-img.collection img, .card-img.page img { object-fit: cover; padding: 0; }
.ph-note { position: absolute; left: 8px; bottom: 8px; background: rgba(255, 255, 255, .9); color: var(--muted); font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.star { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .92); font-size: 18px; cursor: pointer; color: var(--muted); line-height: 1; }
.star.on { color: #c08a00; border-color: #e7c766; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card-brand { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card-name { font-weight: 600; color: var(--text); font-size: 15px; line-height: 1.3; }
.card-meta, .card-dims { font-size: 13px; color: var(--muted); }
.card .price { margin-top: auto; padding-top: 6px; }
.price { display: flex; flex-direction: column; gap: 1px; }
.price .net { font-weight: 700; font-size: 16px; }
.price .gross { font-size: 13px; color: var(--muted); }
.price small { font-weight: 400; color: var(--muted); font-size: 12px; }
.price .cost { color: var(--cost); font-weight: 700; font-size: 14px; }
.price.none { color: var(--muted); font-size: 13px; }
.price.big .net { font-size: 24px; }
.price.big .gross { font-size: 15px; }
.price.big .cost { font-size: 18px; }
.old-list { display: inline-block; font-size: 11px; color: var(--warn); background: var(--warn-bg); border-radius: 5px; padding: 0 6px; }
.pager { display: flex; justify-content: center; gap: 18px; align-items: center; margin: 26px 0; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); }

/* ---------- product ---------- */
.product { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.gallery { position: sticky; top: 76px; }
.g-main { position: relative; display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); aspect-ratio: 4 / 3; overflow: hidden; }
.g-main img { width: 100%; height: 100%; object-fit: contain; max-width: var(--mw, 100%); margin: 0 auto; }
.g-thumbs { display: flex; gap: 8px; margin-top: 4px; overflow-x: auto; padding-bottom: 4px; }
.g-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 12px; }
.g-thumbs a { flex: 0 0 76px; height: 60px; border: 1px solid var(--line); border-radius: 7px; background: #fff; overflow: hidden; }
.g-thumbs a.on { border-color: var(--accent); }
.g-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.pbrand { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.pbrand a { color: var(--muted); }
.designer { text-transform: none; letter-spacing: 0; }
.product h1 { font-size: 30px; letter-spacing: -.015em; }
.pmeta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.ref { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--muted); }
.range-note { font-size: 13px; color: var(--muted); margin-top: 4px; }
.pactions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 16px; }
.block h2 { font-size: 17px; }
.block h3 { font-size: 15px; margin-top: 18px; }
.block p { margin: 6px 0; }
.dims { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 0; }
.dims div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.dims dt { font-size: 12px; color: var(--muted); }
.dims dd { margin: 0; font-weight: 700; font-size: 17px; }
.tablewrap { overflow-x: auto; }
table.prices, table.disc, table.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
table.prices th, table.disc th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
table.prices td, table.disc td { border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: top; }
table.prices tr:hover td { background: #fafaf7; }
.num { text-align: right !important; white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; }
th.cost, td.cost { color: var(--cost); font-weight: 700; }
.ax { display: inline-block; margin-right: 8px; }
.ax em { font-style: normal; color: var(--muted); font-size: 12px; }
.pg { font-size: 12px; }
.warnnote { color: var(--warn); font-size: 12px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.swatch { margin: 0; font-size: 12px; }
.swatch img, .swatch .nosw { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.swatch figcaption { margin-top: 4px; line-height: 1.3; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.src { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--text); }
.src img { width: 60px; height: 78px; object-fit: cover; border: 1px solid var(--line); }
.block.wide { margin-top: 20px; }
.extra-for { font-size: 14px; }

/* ---------- brands, source, finishes, shortlist ---------- */
.brand-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.brand-head .page-title { margin: 0 10px 0 0; }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.brand-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); }
.brand-card:hover { box-shadow: var(--shadow); text-decoration: none; }
.bimg { aspect-ratio: 16 / 10; background: var(--accent-2); }
.bimg img { width: 100%; height: 100%; object-fit: cover; }
.bbody { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.bbody span { font-size: 13px; color: var(--muted); }
.bbody .cost { color: var(--cost); font-weight: 600; }
.type-links { margin: 6px 0 4px; }
.docs { padding-left: 18px; }
.docs li { margin: 6px 0; }
.page-img img { margin: 10px auto; border: 1px solid var(--line); background: #fff; max-height: 92vh; }
.source-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.source-head .page-title { margin: 0; font-size: 20px; flex: 1; }
.finish-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
table.compare th { text-align: left; width: 110px; font-size: 12px; color: var(--muted); vertical-align: top; padding: 8px; }
table.compare td { vertical-align: top; padding: 8px; border-bottom: 1px solid var(--line); min-width: 190px; background: var(--surface); }
.cmp-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }

/* ---------- settings ---------- */
.settings-cost.on { border-color: var(--cost); }
.toggle-form { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.switch { width: 64px; height: 34px; border-radius: 17px; border: 0; background: #c9ccc9; position: relative; cursor: pointer; padding: 0; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s; }
.switch.is-on { background: var(--cost); }
.switch.is-on .knob { left: 33px; }
.switch-label { font-weight: 600; }
.disc-form input { width: 110px; }
.disc-form .btn { margin-top: 10px; }
.pw-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.notes li { margin: 4px 0; }

/* ---------- cost mode: red frame like a service mode ---------- */
.cost-frame { position: fixed; inset: 0; border: 6px solid var(--cost); pointer-events: none; z-index: 1000; }
.cost-banner { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 12px; background: var(--cost); color: #fff; padding: 5px 12px; font-size: 13px; }
.cost-banner button { font: inherit; font-size: 12px; background: #fff; color: var(--cost); border: 0; border-radius: 5px; padding: 2px 9px; cursor: pointer; font-weight: 700; }
.cost-mode .top { top: 31px; }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.login h1 { margin: 10px 0 0; font-size: 24px; }
.login p { margin: 0 0 12px; color: var(--muted); }
.login input { font-size: 16px; padding: 10px; }
.login .btn { justify-content: center; padding: 11px; margin-top: 6px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 18, 16, .92); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 88vh; background: #fff; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; font-size: 34px; width: 52px; height: 52px; border-radius: 50%; cursor: pointer; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-cap { position: absolute; bottom: 14px; color: #ddd; font-size: 13px; }

/* ---------- phone / tablet ---------- */
@media (max-width: 980px) {
  .search-layout { grid-template-columns: 1fr; }
  .filters { position: fixed; inset: 0 auto 0 0; width: min(340px, 88vw); max-height: none; z-index: 300; border-radius: 0; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  .filters.open { transform: none; }
  .close-filters { display: inline-block; background: none; border: 0; font-size: 26px; cursor: pointer; }
  .js .apply { display: flex; position: sticky; bottom: 0; }
  .open-filters { display: inline-flex; }
  .product { grid-template-columns: 1fr; gap: 16px; }
  .gallery { position: static; }
}
@media (max-width: 720px) {
  .top { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .logo span { display: none; }
  .topsearch { order: 3; flex-basis: 100%; max-width: none; }
  .mainnav { margin-left: auto; }
  .mainnav a { padding: 6px 8px; font-size: 14px; }
  .main { padding: 14px 16px 30px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-name { font-size: 14px; }
  .price .net { font-size: 15px; }
  .product h1 { font-size: 24px; }
  .sortform { margin-left: 0; }
  .cost-mode .top { top: 29px; }
  .filters { top: 0; }
}

/* ---------- print ---------- */
@media print {
  .top, .foot, .filters, .pactions, .star, .crumbs, .cost-banner, .g-thumbs, .sources, .lightbox { display: none !important; }
  body { background: #fff; }
  .block { border: 0; padding: 0; }
  .product { grid-template-columns: 1fr 1fr; }
  .gallery { position: static; }
}
