:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #dde3ef;
  --text: #0f172a;
  --muted: #64748b;
  --blue: #1d4ed8;
  --blue2: #2563eb;
  --ok: #0f9f56;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, "Segoe UI", Arial, sans-serif; }
.wrap { max-width: 1380px; margin: 0 auto; padding: 18px; }
.topHeader { display:flex; align-items:center; justify-content:space-between; gap:10px; border:1px solid var(--line); border-radius:16px; background:#fff; padding:8px 12px; margin-bottom:12px; }
.logoLink { display:inline-flex; align-items:center; }
.logo { width: clamp(180px, 20vw, 300px); height:auto; max-height:56px; object-fit:contain; }
.headBtns { display:flex; align-items:center; gap:8px; }
.headBtns .btn,
.headBtns a.btn {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 0;
  border-radius: 12px;
  background: #111;
  color: #fff;
  clip-path: polygon(0 0, 88% 0, 100% 50%, 88% 100%, 0 100%);
  transition: transform .2s ease, background-color .2s ease;
}
.headBtns .btn:hover,
.headBtns a.btn:hover { background:#2a2a2a; transform: translateY(-1px); }
.headBtns .btn.primary,
.headBtns a.btn.primary { background:#000; }
.top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.top #q { flex: 0 1 30%; min-width: 230px !important; max-width: 420px; }
.topFacets { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.facetDrop { position: relative; }
.facetDropBtn { min-width: 124px; justify-content: space-between; font-size: 12px; min-height: 34px; padding: 7px 10px; border-radius: 10px; }
.topFacets > .btn { font-size: 12px; min-height: 34px; padding: 7px 10px; border-radius: 10px; }
.facetSort { font-size: 12px; min-height: 34px; padding: 7px 10px; border-radius: 10px; min-width: 140px; }
.facetDropPanel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 80;
  width: min(320px, 88vw);
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  padding: 8px;
}
.facetDrop.open .facetDropPanel { display: grid; gap: 5px; }
.facetItem { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #334155; cursor: pointer; }
.facetItem input { margin: 0; }
.facetEmpty { color: #64748b; font-size: 12px; padding: 4px; }
.brand { font-size: 22px; font-weight: 900; margin-right: auto; letter-spacing: .01em; }
.btn, .input, select, textarea { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 12px; padding: 10px 12px; }
.btn { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.btn.primary { background: linear-gradient(180deg, var(--blue2), var(--blue)); color: #fff; border-color: #174bc7; }
.btn:disabled { opacity:.55; cursor:not-allowed; }
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; align-items: start; }
.layout.filters-closed { grid-template-columns: minmax(0, 1fr); }
.layout.filters-closed .sidebar { display: none; }
.sidebar { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; position: sticky; top: 16px; display: grid; gap: 8px; }
.sideTitle { font-weight: 600; margin-bottom: 8px; }
.catList { display: grid; gap: 6px; }
.catBtn { width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; }
.catBtn:hover { border-color: #bfd0f4; background: #f8fbff; }
.catBtn.active { border-color: #b8cdfb; background: #eaf2ff; color: #123ca1; font-weight: 500; }
.catGroup { display:grid; gap:6px; }
.catParent { width:100%; display:flex; justify-content:space-between; align-items:center; border:1px solid var(--line); background:#f8fafc; color:#0f172a; padding:9px 10px; border-radius:10px; cursor:pointer; font-weight:500; }
.catParent:hover { background:#f1f5f9; }
.catChild { margin-left:14px; width: calc(100% - 14px); }
.content { min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 330px; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04); cursor:pointer; }
.pic { height: 160px; border-radius: 10px; border: 1px solid var(--line); background: linear-gradient(180deg, #f7f9ff, #eef2fb); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.ph { color: #8ea0bf; font-size: 12px; text-align: center; padding: 8px; }
.name { font-weight: 800; line-height: 1.24; min-height: 40px; }
.meta { font-size: 12px; color: var(--muted); }
.price { font-size: 20px; font-weight: 900; color: #0f172a; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill { font-size: 12px; padding: 4px 8px; border-radius: 999px; background: rgba(15,159,86,.11); color: var(--ok); border: 1px solid rgba(15,159,86,.28); }
.pager { margin-top: 12px; display: flex; align-items: center; gap: 8px; justify-content: center; }
.loadState { margin: 12px 0 4px; text-align: center; min-height: 18px; }
.loadTrigger { height: 1px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.desc { color: var(--muted); line-height: 1.45; }
.qty { width: 90px; }
.formGrid { display:grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap:10px; }
.field { display:flex; flex-direction:column; gap:6px; font-size:12px; color:#64748b; }
.field span { font-weight:700; color:#334155; }
.thumbs { display:grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap:8px; margin:10px 0 4px; }
.thumbBtn { width:100%; height:72px; border:1px solid var(--line); border-radius:10px; background:#fff; padding:4px; cursor:pointer; }
.thumbBtn img { width:100%; height:100%; object-fit:contain; }
.thumbBtn.active { border-color:#2563eb; box-shadow:0 0 0 2px rgba(37,99,235,.14); }
.thumbOut { border-color:#ef4444; background:#fff5f5; }
.modalMainPic { height: 320px !important; }
.stockOk { color:#0f9f56; }
.stockBad { color:#dc2626; font-weight:700; }
.descCard { border:1px solid var(--line); background:linear-gradient(180deg,#fbfdff,#f6f9ff); border-radius:12px; padding:10px 12px; }
.subLabel { color: #334155; font-weight: 700; }
.tagWrap { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.tag { display:inline-flex; border:1px solid var(--line); background:#f8fafc; color:#0f172a; border-radius:999px; padding:4px 8px; font-size:12px; }
.customGrid { display:grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap:10px; margin-top:10px; }
.customCard { border:1px solid var(--line); border-radius:10px; padding:10px; background:#f8fafc; }
.customTitle { font-weight:800; color:#0f172a; margin-bottom:6px; }
.customRow { display:flex; justify-content:space-between; gap:8px; padding:2px 0; font-size:13px; }
.customRow span { color:#64748b; }
.customRow b { color:#0f172a; text-align:right; }
.modalOverlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .62); backdrop-filter: blur(3px); display:flex; align-items:center; justify-content:center; z-index:9999; padding:16px; }
.modalCard { width:min(1080px, 96vw); max-height:92vh; overflow:auto; background:#fff; border:1px solid var(--line); border-radius:18px; padding:16px; position:relative; box-shadow:0 24px 60px rgba(0,0,0,.24); }
.closeBtn { position: sticky; top: 0; margin-left: auto; display:flex; }
.authCard { width: min(520px, 96vw); }
.productModalGrid { display:grid; grid-template-columns: minmax(300px, 40%) minmax(360px, 1fr); gap:16px; }
.productModalMedia { display:grid; gap:10px; align-content:start; }
.productModalInfo { display:grid; gap:8px; align-content:start; }
.productTitle { font-size:24px; line-height:1.2; min-height:auto; }
.modalPreviewPic { height: 210px; }
.authTitle { font-size: 22px; font-weight: 900; margin: 2px 0 10px; }
.authTabs { display:flex; gap:8px; margin-bottom:10px; }
.authGrid { display:grid; grid-template-columns: 1fr; gap:8px; }
.authHint { margin-top: 8px; font-size: 12px; color: var(--muted); }
.authError { margin-top: 8px; color:#dc2626; font-size: 13px; font-weight: 700; }
.authUserBadge { border-color:#b7d3ff; background:#eef4ff; }
.imageZoomOverlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.84);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.imageZoomOverlay img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  transform: scale(.92);
  opacity: 0;
}
.imageZoomOverlay img.zoomIn { animation: zoomInModal .22s ease-out forwards; }
.imageZoomClose {
  position: absolute;
  top: 14px;
  right: 14px;
  min-width: 36px;
  min-height: 36px;
}
@keyframes zoomInModal {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (max-width: 980px) {
  .topHeader {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }
  .logo {
    width: clamp(150px, 54vw, 220px);
    max-height: 46px;
  }
  .headBtns {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .headBtns .btn,
  .headBtns a.btn {
    width: 100%;
    min-height: 30px;
    padding: 5px 4px;
    font-size: 11px;
    border-radius: 8px;
    text-align: center;
    clip-path: none;
  }
  .headBtns #authBtn {
    grid-column: span 3;
  }
  .top #q { flex-basis: 60%; max-width: 100%; }
  .top { gap: 8px; }
  .top #q { flex-basis: 100%; min-width: 0 !important; }
  .topFacets { width: 100%; }
  .facetDrop { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .facetDropBtn { min-width: 100%; width: 100%; }
  .facetSort { min-width: 100%; width: 100%; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .productModalGrid { grid-template-columns: 1fr; gap: 12px; }
  .modalMainPic { height: 240px !important; }
  .modalPreviewPic { height: 170px; }
}
