/* ФЕРМО Store — светлый enterprise (B2B IT-оборудование). Токены на CSS-переменных,
   акцент бренда через --accent (override из tenant.theme в base.html). */
:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --paper: #ffffff;
  --bg: #f5f7fa;
  --line: #e3e8ef;
  --accent: #1746e6;
  --accent-d: #0f37bd;
  --ok: #0f8a3c;
  --ok-bg: #e7f6ec;
  --r: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }

/* ── Утилитарная полоса ── */
.util { background: #0f172a; color: #cbd5e1; font-size: 13px; }
.util-in { display: flex; align-items: center; justify-content: space-between; height: 38px; }
.util-tag { letter-spacing: .01em; }
.util-r { display: flex; gap: 20px; }
.util-r a { color: #e2e8f0; text-decoration: none; }
.util-r a:hover { color: #fff; }

/* ── Шапка ── */
.hdr { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.hdr-in { display: flex; align-items: center; gap: 28px; height: 76px; }
.brand { font-weight: 800; font-size: 25px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand-dot { color: var(--accent); }
.search { margin-left: 8px; display: flex; flex: 1; max-width: 640px; }
.search input { flex: 1; padding: 12px 16px; border: 1.5px solid var(--line); border-right: 0; border-radius: var(--r) 0 0 var(--r); font: inherit; outline: none; }
.search input:focus { border-color: var(--accent); }
.search button { padding: 0 22px; border: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.search button:hover { background: var(--accent-d); }
.cart-link { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.cart-n { background: var(--accent); color: #fff; border-radius: 99px; min-width: 22px; height: 22px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }

/* ── Навигация категорий ── */
.catnav { background: var(--paper); border-bottom: 1px solid var(--line); }
.catnav-in { display: flex; gap: 28px; height: 48px; align-items: center; overflow-x: auto; }
.catnav a { color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; height: 48px; display: inline-flex; align-items: center; }
.catnav a:hover { color: var(--accent); }
.catnav a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Hero ── */
.hero { background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #1746e6 160%); color: #fff; }
.hero-in { padding: 56px 24px 60px; max-width: 880px; }
.hero h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.025em; margin: 0 0 14px; }
.hero p { font-size: 17px; color: #cbd5e1; margin: 0 0 26px; max-width: 620px; }
.hero-search { display: flex; max-width: 600px; }
.hero-search input { flex: 1; padding: 15px 18px; border: 0; border-radius: var(--r) 0 0 var(--r); font: inherit; }
.hero-search button { padding: 0 28px; border: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.hero-search button:hover { background: var(--accent-d); }

/* ── Trust-бар ── */
.trust { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 28px 0 8px; }
.trust div { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; }
.trust b { font-size: 15px; }
.trust span { color: var(--muted); font-size: 13px; }

/* ── Секции ── */
.sec-h { font-size: 22px; letter-spacing: -.02em; margin: 36px 0 16px; }
.sec-row { display: flex; align-items: baseline; justify-content: space-between; margin: 36px 0 16px; }
.sec-row .sec-h { margin: 0; }
.sec-all { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px; }

/* ── Плитки категорий ── */
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 20px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 8px; min-height: 104px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.cat:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.cat-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.cat-cnt { color: var(--muted); font-size: 13px; margin-top: auto; }

/* ── Сетка товаров ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px; margin: 18px 0 8px; }
.pcard { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; color: inherit; display: flex; flex-direction: column; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: #c7d2fe; box-shadow: var(--shadow); }
.pcard-img { height: 180px; display: flex; align-items: center; justify-content: center; background: #fff; border-bottom: 1px solid var(--line); padding: 14px; }
.pcard-img img { max-width: 100%; max-height: 152px; object-fit: contain; mix-blend-mode: multiply; }
.noimg { color: #cbd5e1; font-size: 13px; }
.pcard-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.pcard-brand { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.pcard-title { font-size: 14px; line-height: 1.4; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard-price { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.chip { font-size: 11px; padding: 3px 9px; border-radius: 99px; font-weight: 700; white-space: nowrap; }
.chip.in { background: var(--ok-bg); color: var(--ok); }
.chip.out { background: #f1f5f9; color: var(--muted); }

/* ── Хлебные крошки / заголовок ── */
.crumbs { font-size: 13px; color: var(--muted); margin: 20px 0 4px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.h1 { font-size: 28px; letter-spacing: -.02em; margin: 10px 0; }
.h2 { font-size: 18px; margin: 0 0 12px; }
.empty { padding: 50px 0; color: var(--muted); }
.empty a, .sec-all { color: var(--accent); }

/* ── Пагинация ── */
.pager { display: flex; gap: 18px; align-items: center; justify-content: center; margin: 34px 0 56px; color: var(--muted); }
.pager a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ── Кнопки ── */
.btn { padding: 11px 20px; border: 0; border-radius: var(--r); background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--accent-d); }
.btn-lg { padding: 14px 30px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 8px 13px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
.btn-x { padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--muted); cursor: pointer; }

/* ── Карточка товара ── */
.pd-top { display: grid; grid-template-columns: 440px 1fr; gap: 40px; align-items: start; margin: 8px 0 56px; }
.pd-img { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); height: 420px; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pd-img img { max-width: 100%; max-height: 372px; object-fit: contain; mix-blend-mode: multiply; }
.pd-title { font-size: 26px; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 14px; }
.pd-meta { display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); font-size: 14px; margin-bottom: 22px; }
.pd-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.pd-price { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.pd-stock { margin: 10px 0 18px; }
.pd-note { color: var(--muted); font-size: 13px; margin: 16px 0 0; }
@media (max-width: 860px) { .pd-top { grid-template-columns: 1fr; } .pd-img { height: 300px; } }

/* ── Корзина / checkout (server-rendered формы) ── */
.cart { width: 100%; border-collapse: collapse; margin: 18px 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cart td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cart tr:last-child td { border-bottom: 0; }
.ci-title a { color: var(--ink); text-decoration: none; font-weight: 600; }
.ci-price, .ci-sum { white-space: nowrap; font-weight: 700; }
.qtyf { display: flex; gap: 6px; }
.qtyf input { width: 64px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.cart-foot { display: flex; align-items: center; justify-content: flex-end; gap: 22px; margin: 18px 0 48px; }
.total { font-size: 19px; }
.sm { font-size: 13px; }
.co-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: start; margin: 18px 0 48px; }
.co-form { display: flex; flex-direction: column; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.co-form label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); }
.co-form input, .co-form textarea { padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); }
.co-form input:focus, .co-form textarea:focus { border-color: var(--accent); outline: none; }
.co-sum { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.co-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.co-total { display: flex; justify-content: space-between; padding-top: 14px; font-size: 19px; }

/* ── Кабинет / авторизация ── */
.auth-box { max-width: 420px; margin: 40px auto 60px; }
.auth-box .co-form { margin-top: 16px; }
.auth-err { background: #fdeaea; color: #b5240f; padding: 11px 14px; border-radius: 8px; font-size: 14px; }
.acc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-top: 24px; }

/* ── Доставка на checkout ── */
.ship-row { display: flex; gap: 8px; }
.ship-row input { flex: 1; }
.ship-opts:empty { display: none; }
.ship-list { display: flex; flex-direction: column; gap: 8px; }
.ship-opt { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.ship-opt:has(input:checked) { border-color: var(--accent); background: #f5f8ff; }
.ship-opt input { margin: 0; }
.ship-name { flex: 1; font-size: 14px; }
.ship-cost { font-weight: 700; white-space: nowrap; }


/* ── Выбор оплаты ── */
.pay-pick { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.pay-h { font-size: 14px; color: var(--muted); }
.pay-opt { display: flex; align-items: center; gap: 8px; font-size: 14px; }


/* ── Фильтры каталога ── */
.cat-layout { display: grid; grid-template-columns: 248px 1fr; gap: 28px; align-items: start; margin-bottom: 40px; }
.filters { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; position: sticky; top: 92px; }
.flt-group { margin-bottom: 18px; }
.flt-h { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.flt-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.flt-price { display: flex; gap: 8px; }
.flt-price input, .flt-sel { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.btn-block { width: 100%; }
.flt-reset { display: block; text-align: center; margin-top: 10px; color: var(--muted); font-size: 13px; text-decoration: none; }
.flt-reset:hover { color: var(--accent); }
@media (max-width: 860px) { .cat-layout { grid-template-columns: 1fr; } .filters { position: static; } }

/* ── Характеристики товара ── */
.specs { columns: 2; column-gap: 28px; margin-bottom: 56px; }
.spec-group { break-inside: avoid; margin-bottom: 18px; }
.spec-gh { font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.spec-tbl { width: 100%; border-collapse: collapse; }
.spec-tbl td { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.spec-k { color: var(--muted); width: 52%; padding-right: 12px; }
.spec-v { color: var(--ink); }
@media (max-width: 760px) { .specs { columns: 1; } }

/* ── Контент-страницы ── */
.page { max-width: 820px; padding-bottom: 56px; }
.prose { color: var(--ink-2); font-size: 15px; }
.prose h2 { font-size: 19px; color: var(--ink); margin: 28px 0 10px; letter-spacing: -.01em; }
.prose p { margin: 10px 0; }
.prose ul, .prose ol { margin: 10px 0; padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose .btn { margin-top: 14px; }
.prose-legal { font-size: 14px; color: var(--muted); }
.prose-legal h2 { font-size: 17px; }

/* ── Подвал ── */
.ftr { margin-top: 64px; background: #0f172a; color: #94a3b8; }
.ftr-in { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; padding: 44px 24px; }
.ftr-brand { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.ftr-col { display: flex; flex-direction: column; gap: 8px; }
.ftr-col .muted { color: #94a3b8; }
.ftr-h { color: #fff; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.ftr-col a { color: #cbd5e1; text-decoration: none; font-size: 14px; }
.ftr-col a:hover { color: #fff; }

/* Бренды */
.lead { color: var(--ink-2); max-width: 60ch; margin: 6px 0 22px; }
.brand-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 40px; }
.brand-tile { display: flex; flex-direction: column; gap: 4px; padding: 18px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.brand-tile:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(15,23,42,.08); }
.brand-name { font-weight: 700; color: var(--ink); font-size: 16px; }
.brand-meta { font-size: 13px; color: var(--muted); }

@media (max-width: 860px) {
  .trust, .cats { grid-template-columns: repeat(2, 1fr); }
  .co-grid { grid-template-columns: 1fr; }
  .ftr-in { grid-template-columns: 1fr; gap: 24px; }
  .hero h1 { font-size: 30px; }
  .search { display: none; }
  .brand-grid { grid-template-columns: repeat(2, 1fr); }
}
