/* ============================================================================
   site.tools2.work — вітрина USA TOOLS

   Кольори — з logo.svg і більше нізвідки (див. BRAND.md):
     синій   #22347e — головний, дії та навігація;
     червоний #c31a39 — акцент: ціна, кнопка «Купити», активний стан;
     чорний  #474747 — текст.

   Мобільний вигляд первинний: сітка каталогу — 2 картки в ряд, колонка фільтрів
   висувається поверх списку. Ширші екрани лише додають колонок.

   ПРАВИЛО: після кожної правки цього файлу підняти `?v=` у layout.php — інакше
   змін не видно через кеш браузера.
   ========================================================================== */

:root {
  --blue:  #22347e;
  --blue-d:#182559;
  --blue-l:#3d55b8;
  --red:   #c31a39;
  --red-d: #9d142d;
  --ink:   #474747;
  --ink-2: #6b6b6b;
  --ink-3: #90959c;
  --line:  #e3e6ec;
  --line-2:#eef0f5;
  --bg:    #ffffff;
  --bg-2:  #f5f7fa;
  --ok:    #1a8f4c;
  --rad:   10px;
  --pad:   14px;
  --hdr-h: 58px;
  --wrap:  1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-wrap: break-word;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--red); }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.sr-only, .skip {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip:focus {
  position: fixed; top: 6px; left: 6px; width: auto; height: auto; clip: auto;
  padding: 8px 14px; background: var(--blue); color: #fff; border-radius: 8px; z-index: 60;
}

.muted { color: var(--ink-3); }
.sm    { font-size: 13px; }

/* ─────────────────────────────── Шапка ─────────────────────────────── */
/* Шапка мусить бути ЗАПОВНЕНОЮ, а не смужкою з логотипом і двома кнопками: на
   широкому екрані в ній стоїть великий логотип із підписом, посередині — пошук,
   справа — мова й РОЗГОРНУТИЙ кошик («0 товарів»). На телефоні той самий каркас
   переноситься: логотип і кошик у рядок, пошук — другим рядком. */

.hdr {
  position: sticky; top: 0; z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.hdr-in {
  max-width: var(--wrap); margin: 0 auto;
  padding: 9px var(--pad);
  display: flex; align-items: center; flex-wrap: wrap; gap: 9px 16px;
}
.hdr-logo { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.logo { height: 42px; width: auto; display: block; }
.logo.sm { height: 34px; }

/* Підпис біля логотипа: домен і одне речення про суть магазину. На телефоні його
   нема — там на нього просто нема ширини, і логотип важливіший. */
.hdr-sub { display: none; line-height: 1.25; }
.hdr-sub b {
  display: block; font-size: 15px; font-weight: 800; letter-spacing: .02em; color: var(--blue);
}
.hdr-sub i { display: block; font-style: normal; font-size: 12.5px; color: var(--ink-2); }

.hdr-act { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.lang {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 38px; padding: 0 10px;
  border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--blue);
  background: #fff;
}
.lang:hover { border-color: var(--blue); background: var(--blue); color: #fff; }

.cart-btn {
  display: inline-flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 10px; border-radius: 9px;
  background: var(--blue); color: #fff;
}
.cart-btn:hover { background: var(--blue-d); color: #fff; }
.cart-ic { position: relative; display: inline-flex; align-items: center; }
.cart-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.cart-n {
  position: absolute; top: -7px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px;
  display: none; align-items: center; justify-content: center;
  background: var(--red); border-radius: 10px;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.cart-btn.has .cart-n { display: flex; }
.cart-tx { display: none; line-height: 1.2; text-align: left; }
.cart-tx b { display: block; font-size: 13px; font-weight: 700; }
.cart-tx i { display: block; font-style: normal; font-size: 11.5px; opacity: .8; white-space: nowrap; }

/* ─────────────────────────────── Пошук ─────────────────────────────── */
/* Пошук живе В ШАПЦІ (а не окремим рядком під нею): на широкому екрані він займає
   середину, на телефоні переноситься другим рядком тієї ж шапки. */

.srch { flex: 1 1 100%; order: 3; display: flex; gap: 8px; }
.srch input {
  flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 13px;
  border: 1.5px solid var(--line); border-radius: 8px; background: #fff;
}
.srch input:focus { outline: none; border-color: var(--blue); }
.srch button {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 44px; height: 40px; padding: 0; border: 0; border-radius: 8px;
  background: var(--blue); color: #fff; cursor: pointer; font-weight: 700; font-size: 13.5px;
}
.srch button:hover { background: var(--blue-d); }
.srch svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }
.srch-tx { display: none; }

/* ────────────────────────────── Категорії ────────────────────────────── */
/* Стрічка категорій горизонтально прокручується: вісім розділів у стовпчик
   зʼїли б увесь перший екран телефона. Чисел біля назв тут НЕМА свідомо — вони
   зліплювались із назвою («Мережевий інструмент3») і читались як частина слова. */

.cats { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.cats-in {
  max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad);
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
}
.cats-in::-webkit-scrollbar { display: none; }
.cat-lnk {
  flex: 0 0 auto; padding: 11px 12px;
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.cat-lnk:hover { color: var(--blue); }
.cat-lnk.on { color: var(--blue); border-bottom-color: var(--red); }

/* ─────────────────────────────── Каркас ─────────────────────────────── */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 14px var(--pad) 40px; }

.crumbs { font-size: 12.5px; color: var(--ink-3); margin: 0 0 10px; }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--red); }
.crumbs b { font-weight: 600; color: var(--ink-3); }
.crumbs span { margin: 0 6px; }

.h1 {
  margin: 0 0 12px; font-size: 22px; line-height: 1.25; font-weight: 800; color: var(--blue);
}
.h1 span { display: block; font-size: 14px; font-weight: 600; color: var(--ink-3); margin-top: 3px; }
.h2 { margin: 28px 0 12px; font-size: 17px; font-weight: 800; color: var(--blue); }

/* ───────────────────────────── Кнопки ───────────────────────────── */

/* Головна дія сайту — обʼємна, фірмовим червоним: градієнт зверху вниз, світлий
   відблиск усередині й «підошва» знизу. Натиск вдавлює кнопку (`translateY`), тож
   вона поводиться як фізична, а не як пляма кольору. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 20px; border: 0; border-radius: 9px;
  color: #fff; font-weight: 700; cursor: pointer; text-align: center; white-space: nowrap;
  background: linear-gradient(180deg, #e34260 0%, var(--red) 52%, var(--red-d) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), 0 2px 0 #7d0f22,
              0 4px 11px rgba(163, 18, 44, .30);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
  transition: transform .08s, box-shadow .08s, filter .12s;
}
.btn:hover { color: #fff; filter: brightness(1.07); }
.btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24), 0 0 0 #7d0f22, 0 2px 5px rgba(163, 18, 44, .28);
}
.btn.big  { min-height: 48px; font-size: 16px; }
.btn.sm   { min-height: 34px; padding: 0 13px; font-size: 13px; }
/* Другорядна кнопка плоска навмисно: обʼєм на сторінці має бути в ОДНОГО елемента,
   інакше жоден із них уже не читається як головний. */
.btn.ghost {
  background: #fff; color: var(--blue); border: 1.5px solid var(--line);
  box-shadow: none; text-shadow: none;
}
.btn.ghost:hover { border-color: var(--blue); background: var(--bg-2); color: var(--blue); filter: none; }
.btn.ghost:active { transform: none; box-shadow: none; }
.wfull { width: 100%; }

/* Іконка кошика в кнопці — текстова (емодзі), а не svg: вона мусить успадковувати
   розмір і колір підпису й не тягнути за собою ще один файл. */
.bic { font-size: 14px; line-height: 1; }
.btn.big .bic { font-size: 17px; }

.lnk {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--ink-3); text-decoration: underline;
}
.lnk:hover { color: var(--red); }

/* ───────────────────────── Плитка категорій ───────────────────────── */

.tiles {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 4px 0 8px;
}
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  min-height: 92px; padding: 13px;
  border: 1.5px solid var(--line); border-radius: var(--rad); background: #fff;
  border-left: 4px solid var(--blue);
}
.tile:hover { border-color: var(--line); border-left-color: var(--red); background: var(--bg-2); }
.tile-n { font-weight: 700; font-size: 14px; color: var(--ink); line-height: 1.3; }
.tile-c { font-size: 12px; color: var(--ink-3); }

/* ────────────────────── Сітка каталогу (2 в ряд) ────────────────────── */
/* «По 2 в ряд і 16 на сторінку» — так задумано для телефона. На широкому екрані
   дві колонки дали б картки завширшки з долоню, тому колонок додається, а число
   товарів на сторінці (16) лишається тим самим і ділиться націло і на 2, і на 4. */

.grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}

/* Рамка одразу 2px і в звичайному стані теж: якби ховер її потовщував, картка
   під курсором «підстрибувала» б на пів пікселя, а сусідні розʼїжджались. */
.card {
  display: flex; flex-direction: column;
  border: 2px solid var(--line); border-radius: var(--rad); background: #fff; overflow: hidden;
}
.card:hover { border-color: var(--ink); }
.card-ph {
  display: block; aspect-ratio: 1 / 1; background: #fff; padding: 8px;
}
.card-ph img { width: 100%; height: 100%; object-fit: contain; }
.card-b { display: flex; flex-direction: column; gap: 6px; padding: 10px; flex: 1 1 auto; }
.card-n {
  color: var(--ink); font-size: 13.5px; line-height: 1.35; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-n:hover { color: var(--blue); }
.card-sku { font-size: 11.5px; color: var(--ink-3); font-family: ui-monospace, Menlo, Consolas, monospace; }
/* Ціна й кнопка стоять СТОВПЧИКОМ на ВСІХ ширинах. Поруч вони не тримаються: у
   сітці ширина рядка залежить від довжини ціни, і «10 999 грн» переносив кнопку
   на новий рядок, а «589 грн» — ні; підпис «Вже в кошику» довший за «До кошика»
   і роздував кнопку рівно в тих картках, де товар уже набрано. Стовпчик із
   фіксованою висотою кнопки — єдиний варіант, у якому сусідні картки однакові. */
.card-f { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.price { font-size: 17px; font-weight: 800; color: var(--red); white-space: nowrap; }
.price span { font-size: 12px; font-weight: 700; }
.price.big { font-size: 27px; }

.buy {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: 38px; flex: 0 0 38px; padding: 0 10px;
  border: 0; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden;
  color: #fff;
  background: linear-gradient(180deg, #e34260 0%, var(--red) 52%, var(--red-d) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), 0 2px 0 #7d0f22,
              0 3px 8px rgba(163, 18, 44, .26);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
  transition: transform .08s, box-shadow .08s, filter .12s;
}
.buy:hover { filter: brightness(1.07); }
.buy:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24), 0 0 0 #7d0f22, 0 2px 5px rgba(163, 18, 44, .26);
}
.buy .btx { overflow: hidden; text-overflow: ellipsis; }

/* «Вже в кошику» — сталий зелений, а не спалах: у списку покупець мусить бачити,
   що саме він уже набрав. Кнопка при цьому лишається РОБОЧОЮ (натиск докладає ще
   одну штуку), тому вона не блякне й не вимикається. */
.buy.in, .btn.in, .buy.done, .btn.done {
  background: linear-gradient(180deg, #35b46b 0%, var(--ok) 52%, #137a3f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .30), 0 2px 0 #0d5c2f,
              0 3px 8px rgba(19, 122, 63, .26);
}
.buy:disabled, .btn:disabled { opacity: .6; cursor: default; }

.noph {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; background: var(--bg-2);
}
.noph-l { width: 55%; max-width: 130px; height: auto; opacity: .3; }

/* ────────────────────── Заголовок списку та сортування ────────────────────── */

.head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.head .h1 { margin: 0; flex: 1 1 100%; }
.head-r { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; justify-content: space-between; }
.found { font-size: 13px; color: var(--ink-3); }
.found b { color: var(--ink); }
.sortf select {
  height: 36px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 8px;
  background: #fff; max-width: 190px;
}

/* ──────────────────── Дві колонки: фільтри + список ──────────────────── */

.cols { display: block; }

.fbtn {
  width: 100%; min-height: 42px; margin-bottom: 12px;
  border: 1.5px solid var(--blue); border-radius: 9px; background: #fff;
  color: var(--blue); font-weight: 700; cursor: pointer;
}
.fbtn i {
  font-style: normal; margin-left: 7px; padding: 1px 7px;
  background: var(--red); color: #fff; border-radius: 9px; font-size: 12px;
}

/* На телефоні колонка виїжджає збоку поверх сторінки: інакше довгий список
   значень відсував би товари на другий екран ще до того, як їх побачили. */
.side {
  position: fixed; inset: 0 auto 0 0; z-index: 50;
  width: min(88vw, 340px); background: #fff; border-right: 1px solid var(--line);
  transform: translateX(-102%); transition: transform .2s ease;
  overflow-y: auto; padding: 0 0 20px;
}
body.side-on .side { transform: none; box-shadow: 0 0 0 100vmax rgba(24, 37, 89, .35); }
body.side-on { overflow: hidden; }

.side-h {
  position: sticky; top: 0; z-index: 2; background: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 13px var(--pad); border-bottom: 1px solid var(--line);
  font-weight: 800; color: var(--blue);
}
.side-h span { flex: 1 1 auto; }
.reset { font-size: 13px; font-weight: 600; color: var(--red); }
.side-x {
  border: 0; background: none; font-size: 26px; line-height: 1; color: var(--ink-3);
  cursor: pointer; padding: 0 2px;
}

.side form { padding: 0 var(--pad); }
.fgrp { border-bottom: 1px solid var(--line-2); }
.fgrp summary {
  list-style: none; cursor: pointer; padding: 12px 22px 12px 0; position: relative;
  font-weight: 700; font-size: 13.5px; color: var(--ink);
}
.fgrp summary::-webkit-details-marker { display: none; }
.fgrp summary::after {
  content: ''; position: absolute; right: 4px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform .15s;
}
.fgrp[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.fvals { padding: 0 0 10px; max-height: 260px; overflow-y: auto; }

.fv {
  display: flex; align-items: center; gap: 8px; padding: 6px 2px;
  font-size: 13.5px; cursor: pointer;
}
.fv span { flex: 1 1 auto; }
.fv i { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.fv input { width: 17px; height: 17px; accent-color: var(--blue); flex: 0 0 auto; }
.fv.on span { color: var(--blue); font-weight: 700; }
.fv:hover span { color: var(--red); }

.side .btn { margin-top: 14px; }

/* ────────────────────── Підрозділи категорії ────────────────────── */
/* Це НАВІГАЦІЯ, а не фільтр: окремі сторінки зі своїми адресами. Тому й вигляд
   інший — список посилань із виділеним поточним, а не галочки. */

.subnav { padding: 8px var(--pad) 12px; }
/* Другий заголовок у колонці: зверху «Розділи» (навігація), під ними «Фільтри»
   (звуження). Без нього обидва списки виглядали як один довгий фільтр. */
.side-h2 {
  margin: 0 calc(var(--pad) * -1) 4px; padding: 11px var(--pad) 9px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line-2);
  background: var(--bg-2); font-weight: 800; font-size: 13.5px; color: var(--blue);
}
.subl {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 2px;
  border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.subl i { margin-left: auto; font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.subl:hover { background: var(--bg-2); color: var(--blue); }
.subl.on { background: var(--blue); color: #fff; }
.subl.on i { color: rgba(255, 255, 255, .72); }

.subtiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.subt {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 10px 12px; background: #fff;
  border: 2px solid var(--line); border-left-width: 4px; border-left-color: var(--blue);
  border-radius: var(--rad); font-size: 12.5px; font-weight: 700; color: var(--ink); line-height: 1.3;
}
.subt i { font-style: normal; font-weight: 600; font-size: 11.5px; color: var(--ink-3); }
.subt:hover { border-color: var(--ink); border-left-color: var(--red); color: var(--ink); }
.subt.on { border-color: var(--red); border-left-color: var(--red); color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 20px; background: var(--bg-2);
  border: 1px solid var(--line); font-size: 12.5px; color: var(--ink);
}
.chip span { color: var(--ink-3); font-weight: 700; }
.chip:hover { border-color: var(--red); color: var(--red); }
.chip:hover span { color: var(--red); }

/* ───────────────────────────── Пагінація ───────────────────────────── */

.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 22px; }
.pg {
  min-width: 38px; height: 38px; padding: 0 11px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); border-radius: 8px; font-size: 13.5px; font-weight: 600;
  background: #fff;
}
.pg:hover { border-color: var(--blue); }
.pg.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.pg-gap { align-self: center; color: var(--ink-3); padding: 0 2px; }

/* ─────────────────────────── Сторінка товару ─────────────────────────── */

.prod { display: block; }
.gal-big {
  border: 1.5px solid var(--line); border-radius: var(--rad); background: #fff;
  padding: 10px; aspect-ratio: 1 / 1;
}
.gal-big img { width: 100%; height: 100%; object-fit: contain; }
.gal-th { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: thin; }
.gth {
  flex: 0 0 auto; width: 66px; height: 66px; padding: 4px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 8px; background: #fff;
}
.gth img { width: 100%; height: 100%; object-fit: contain; }
.gth.on { border-color: var(--red); }

.pinfo { padding-top: 16px; }
.pmeta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 14px; }
.psku { font-size: 13px; color: var(--ink-3); }
.psku b { color: var(--ink); font-family: ui-monospace, Menlo, Consolas, monospace; }
.pav {
  font-size: 13px; font-weight: 700; color: var(--ok);
  display: inline-flex; align-items: center; gap: 5px;
}
.pav::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
}

.pbuy {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 14px; border: 1.5px solid var(--line); border-radius: var(--rad); background: var(--bg-2);
}
.pbuy .btn { flex: 1 1 160px; }

.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; }
.qty button {
  width: 38px; height: 42px; border: 0; background: none; cursor: pointer;
  font-size: 19px; color: var(--blue); line-height: 1;
}
.qty button:hover { color: var(--red); }
.qty input {
  width: 44px; height: 42px; border: 0; text-align: center; font-weight: 700; background: none;
}
.qty input:focus { outline: none; }

.specs { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.specs tr { border-bottom: 1px solid var(--line-2); }
.specs th {
  text-align: left; font-weight: 600; color: var(--ink-3); padding: 9px 12px 9px 0;
  width: 42%; vertical-align: top;
}
.specs td { padding: 9px 0; vertical-align: top; }

.ptext { font-size: 14.5px; line-height: 1.65; }
.ptext img { margin: 10px 0; border-radius: 8px; }
.ptext ul, .ptext ol { padding-left: 20px; }
.more { margin-top: 16px; text-align: center; }

/* ─────────────────────────────── Кошик ─────────────────────────────── */

.ctable { border-top: 1px solid var(--line); }
.crow {
  display: grid; align-items: center; gap: 4px 10px;
  /* minmax(0,1fr), а не 1fr: довга назва товару має ПЕРЕНОСИТИСЬ, а не розсувати
     рядок. З голим 1fr колонка не могла стиснутись менше за свій вміст, рядок
     вилазив за екран — і разом з ним «їхала» вся сторінка, обрізаючи суму справа. */
  grid-template-columns: 64px minmax(0, 1fr) auto;
  grid-template-areas: "ph name x" "ph price price" "ph qty sum";
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.crow-ph { grid-area: ph; }
.crow-ph img { width: 64px; height: 64px; object-fit: contain; }
.crow-n   { grid-area: name; font-size: 13.5px; line-height: 1.35; }
.crow-n a { color: var(--ink); font-weight: 600; }
.crow-n a:hover { color: var(--blue); }
.crow-p   { grid-area: price; font-size: 13px; color: var(--ink-3); }
.crow-q   { grid-area: qty; }
.crow-s   { grid-area: sum; font-weight: 800; color: var(--red); white-space: nowrap; text-align: right; }
.crow-s span, .crow-p span { font-size: 11.5px; font-weight: 700; }
.crow-x {
  grid-area: x; align-self: start; justify-self: end;
  width: 30px; height: 30px; border: 0; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--ink-3);
}
.crow-x:hover { color: var(--red); }
.crow .qty button { width: 32px; height: 34px; }
.crow .qty input  { width: 38px; height: 34px; }

.ctot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 14px 0;
}
.ctot .btn { margin-right: auto; }
.ctot-l { font-weight: 700; }
.ctot-v { font-size: 21px; font-weight: 800; color: var(--red); }
.ctot-v span { font-size: 13px; }

.order { max-width: 520px; margin-top: 8px; }
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.fld > span b { color: var(--red); }
.fld input, .fld textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 9px;
  background: #fff; resize: vertical;
}
.fld input:focus, .fld textarea:focus { outline: none; border-color: var(--blue); }
.fld i { display: block; font-style: normal; font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.err {
  padding: 10px 13px; border-radius: 9px; margin-bottom: 14px;
  background: #fdecef; border: 1px solid #f3c3cd; color: var(--red-d); font-size: 13.5px;
}
/* Приманка для ботів — прибрана з потоку, але НЕ display:none: частина ботів
   спеціально пропускає приховані так поля. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.empty, .done { text-align: center; padding: 40px 10px; }
.empty p, .done p { color: var(--ink-2); margin: 0 0 18px; }
.done .h1 { color: var(--ok); }

/* ─────────────────────────────── Підвал ─────────────────────────────── */

.ftr { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 30px; }
.ftr-in {
  max-width: var(--wrap); margin: 0 auto; padding: 22px var(--pad);
  display: flex; flex-wrap: wrap; gap: 18px 30px;
}
.ftr-logo { flex: 0 0 auto; }
.ftr-txt { font-size: 13px; color: var(--ink-2); }
.ftr-txt a { font-weight: 700; }
.ftr-cats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; flex: 1 1 260px; }
.ftr-cats a { color: var(--ink-2); }
.ftr-cats a:hover { color: var(--red); }
.ftr-cp {
  border-top: 1px solid var(--line); padding: 12px var(--pad);
  text-align: center; font-size: 12px; color: var(--ink-3);
}

/* ─────────────────────────── Повідомлення ─────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 20px);
  z-index: 70; max-width: min(92vw, 420px);
  padding: 12px 18px; border-radius: 10px;
  background: var(--blue); color: #fff; font-size: 14px; font-weight: 600; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  box-shadow: 0 8px 26px rgba(24, 37, 89, .28);
}
.toast.on  { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--red); }

/* ─────────────────────────────── Лайтбокс ─────────────────────────────── */
/* Фото на весь екран, під ним — назва, ціна й «До кошика»: щоб роздивитись товар
   не треба було виходити зі сторінки й повертатись.

   `.lb[hidden]` прописано ЯВНО: атрибут `hidden` — це лише `display:block` у
   таблиці браузера, і будь-який власний `display` його мовчки перебиває. Без
   цього рядка модалка висіла б розкритою завжди. */
.lb {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 14px;
  background: rgba(24, 37, 89, .74);
}
.lb[hidden] { display: none; }
body.lb-on { overflow: hidden; }

.lb-in {
  position: relative; width: 100%; max-width: 940px;
  max-height: calc(100dvh - 28px);
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
}
.lb-ph {
  flex: 1 1 auto; min-height: 0; padding: 16px;
  display: flex; align-items: center; justify-content: center;
}
.lb-ph img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.lb-f {
  flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--bg-2);
  padding: 12px 16px; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap;
}
.lb-t { flex: 1 1 220px; min-width: 0; }
.lb-n { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.lb-p { font-size: 21px; margin-top: 3px; }
.lb-x {
  position: absolute; top: 6px; right: 8px; z-index: 2;
  width: 38px; height: 38px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .9); color: var(--ink);
  font-size: 26px; line-height: 1;
}
.lb-x:hover { background: #fff; color: var(--red); }

/* Підказка, що фото збільшується: без неї на нього просто не натискають. */
.gal-big[data-lb-open] { position: relative; cursor: zoom-in; }
.gal-zoom {
  position: absolute; right: 10px; bottom: 10px;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(34, 52, 126, .82); color: #fff; font-size: 15px;
}

/* ═══════════════════════════ Ширші екрани ═══════════════════════════ */

@media (min-width: 640px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .subtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .h1 { font-size: 26px; }
  .crow {
    grid-template-columns: 72px minmax(0, 1fr) 120px auto 120px 34px;
    grid-template-areas: "ph name price qty sum x";
  }
  .crow-p { text-align: right; font-size: 14px; color: var(--ink); }
}

@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .prod { display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 1fr); gap: 26px; align-items: start; }
  .pinfo { padding-top: 0; }
  .head .h1 { flex: 0 1 auto; }
  .head-r { flex: 0 0 auto; }
}

@media (min-width: 760px) {
  /* Пошук переїжджає в САМУ шапку, між логотипом і кошиком. */
  .srch { flex: 1 1 220px; order: 0; max-width: 560px; }
  .srch button { width: auto; padding: 0 16px; }
  .srch-tx { display: inline; }
  .cart-tx { display: block; }
  .cart-btn { padding: 0 13px 0 11px; height: 42px; }
  .lang { height: 42px; }
}

@media (min-width: 1000px) {
  :root { --pad: 20px; }

  /* Фільтри перестають бути шухлядою й просто стоять збоку. */
  .cols { display: grid; grid-template-columns: 258px minmax(0, 1fr); gap: 22px; align-items: start; }
  /* Категорія без підрозділів і без фасетів бічної колонки не має взагалі —
     порожні 258px зліва виглядали б як недовантажена сторінка. */
  .cols.nocols { display: block; }
  .fbtn, .side-x { display: none; }
  .side {
    position: sticky; top: calc(var(--hdr-h) + 12px); inset: auto;
    width: auto; transform: none; border: 1.5px solid var(--line); border-radius: var(--rad);
    max-height: calc(100vh - var(--hdr-h) - 30px); padding-bottom: 12px;
  }
  body.side-on { overflow: auto; }
  body.side-on .side { box-shadow: none; }
  .side-h { border-radius: var(--rad) var(--rad) 0 0; }

  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  /* Логотип на ПК значно більший — шапка тримається на ньому, а не на тексті. */
  .logo { height: 84px; }
  /* Стрічка категорій перестає прокручуватись і переноситься: на ПК обрізана
     «Системи зберігання інстр» читається як зламана верстка, а не як натяк
     на горизонтальний скрол. */
  .cats-in { flex-wrap: wrap; overflow: visible; }
  .hdr-sub { display: block; }
  .hdr-in { padding: 10px var(--pad); }
  :root { --hdr-h: 96px; }
  .h1 { font-size: 29px; }
  /* Підрозділи на ПК живуть лівим підменю; плитка в основній колонці — для
     телефона, де ліва колонка схована в шухляду. */
  .subtiles { display: none; }
}
