:root {
  --bg: #f3f6f1;
  --card: #ffffff;
  --ink: #122012;
  --muted: #5b6c5b;
  --line: #d5e2d2;
  --green: #57a639;
  --green-dark: #3d7a2a;
  --ink-deep: #0f1c0f;
  --shadow: 0 14px 40px rgba(18, 40, 18, 0.10);
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", "Avenir Next", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e5f4dc 0%, transparent 60%),
    radial-gradient(900px 400px at 100% 0%, #eef6ea 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }

.top {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(15, 28, 15, 0.92);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.top-inner {
  max-width: 1120px; margin: 0 auto;
  padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.brandline { display: flex; gap: 8px; align-items: baseline; font-weight: 600; }
.logo { color: #9fdf86; letter-spacing: 0.02em; }
.sep { opacity: .35; }
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.ghost {
  border: 1px solid rgba(255,255,255,.18);
  background: transparent; color: inherit;
  border-radius: 999px; padding: 8px 12px; cursor: pointer; font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center;
}
#view-brand .ghost, .cart .ghost { color: var(--ink); border-color: var(--line); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 18px 100px; }
.hero { margin-bottom: 22px; max-width: 70ch; }
h1 { margin: 0 0 10px; font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.03em; line-height: 1.1; }
.lead { margin: 0; color: var(--muted); line-height: 1.5; font-size: 15px; }
.eyebrow { margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; font-weight: 800; color: var(--green-dark); }
.fine { color: var(--muted); font-size: 13px; line-height: 1.4; }
.empty { margin-top: 18px; }

.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}
.brand-card {
  appearance: none; border: 1px solid var(--line); background: var(--card);
  border-radius: var(--radius); padding: 12px; text-align: left; cursor: pointer;
  display: grid; gap: 10px; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.brand-card:hover {
  transform: translateY(-2px);
  border-color: rgba(87,166,57,.45);
  box-shadow: var(--shadow);
}
.brand-card .thumb {
  width: 100%; aspect-ratio: 1;
  border-radius: 14px; overflow: hidden;
  background: #eef5eb;
}
.brand-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.brand-card strong { font-size: 15px; letter-spacing: -0.01em; }
.brand-card span { font-size: 12px; color: var(--muted); }
.brand-card .tag {
  display: inline-flex; width: fit-content;
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; color: #fff; background: #1d3a1d;
  border-radius: 999px; padding: 3px 8px;
}

.back {
  border: 0; background: transparent; color: var(--green-dark);
  font-weight: 700; cursor: pointer; padding: 0; margin-bottom: 18px;
}
.brand-head {
  display: grid; grid-template-columns: 120px 1fr; gap: 18px;
  align-items: center; margin-bottom: 22px;
  padding: 16px; border: 1px solid var(--line); border-radius: 22px;
  background: rgba(255,255,255,.78);
}
.brand-photo {
  width: 120px; height: 120px; border-radius: 22px; object-fit: cover;
  background: #eef5eb; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}

.filters { display: grid; gap: 8px; margin-bottom: 20px; }
.filter-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 6px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 9px 13px; cursor: pointer; font-size: 13px; font-weight: 700;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.chip:hover { border-color: rgba(87,166,57,.5); }
.chip.is-on { background: var(--green); border-color: var(--green); color: #fff; }
.chip .badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: rgba(0,0,0,.08); font-size: 11px;
}
.chip.is-on .badge { background: rgba(255,255,255,.22); }
.chip .badge-rec {
  margin-left: 6px;
  background: #1d3a1d;
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.chip.is-on .badge-rec { background: rgba(255,255,255,.28); }

.sets { display: grid; gap: 18px; }
.set-section h2 { margin: 4px 0 6px; font-size: 20px; letter-spacing: -0.02em; }
.set-section .hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; max-width: 80ch; }
.badge-green {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: var(--green); color: #fff; font-size: 11px; font-weight: 800; vertical-align: middle;
}
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.set-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 0; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.set-card:hover { border-color: rgba(87,166,57,.4); box-shadow: var(--shadow); }
.set-thumb {
  aspect-ratio: 4 / 3;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.set-thumb img,
.set-thumb .sg-gallery-wrap > img {
  width: 100%; height: 100%;
  object-fit: contain; object-position: center;
  padding: 10px;
  background: #fff;
}
.set-thumb .sg-gallery-wrap {
  width: 100%;
  height: 100%;
  background: #fff;
  position: relative;
}
.set-thumb .sg-gallery-trigger {
  top: 8px;
  right: 8px;
  min-width: 42px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  gap: 4px;
  background: rgba(15, 28, 15, 0.88);
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.set-thumb .sg-gallery-trigger-count {
  font-size: 12px;
  font-weight: 800;
}
.set-thumb .sg-gallery-img-clickable {
  cursor: zoom-in;
}
.set-thumb--empty { min-height: 160px; background: #fff; }
.set-body {
  padding: 14px; display: grid; gap: 7px; align-content: start;
}
.set-card .sku { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.set-card .name { font-size: 15px; font-weight: 750; line-height: 1.25; }
.set-card .price { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.set-card .net { font-size: 12px; color: var(--muted); }
.set-card .stock--out {
  font-size: 12px; font-weight: 700; color: #8a2f2f;
  background: #fdeeee; border-radius: 10px; padding: 8px 10px;
}
.set-card.is-out { opacity: 0.78; }

.btn {
  border: 0; background: var(--green); color: #fff; border-radius: 12px;
  padding: 11px 12px; font-weight: 800; cursor: pointer; margin-top: 4px; width: 100%;
}
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-dark { background: var(--ink-deep); }

.set-card .stock {
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.set-card.is-active { border-color: rgba(87,166,57,.55); box-shadow: var(--shadow); }

.sg-qty-controls {
  display: grid; grid-template-columns: 40px 1fr 40px; gap: 6px;
  align-items: center; margin-top: 6px;
}
.sg-qty-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  height: 40px; font-size: 18px; font-weight: 800; cursor: pointer; color: var(--ink);
}
.sg-qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.sg-qty-input {
  height: 40px; border: 1px solid var(--line); border-radius: 10px;
  text-align: center; font-weight: 800; font-size: 15px; width: 100%;
}

/* Floating cart — te same klasy / układ co w konfiguratorze (gotowe zestawy) */
:root {
  --accent: var(--green);
  --text: var(--ink);
}
.sg-cta, .sg-cta-secondary {
  appearance: none; border: none; border-radius: 14px; padding: 12px 16px;
  font: inherit; font-weight: 700; cursor: pointer; width: 100%;
}
.sg-cta { background: var(--accent); color: #fff; }
.sg-cta:disabled { opacity: .45; cursor: not-allowed; }
.sg-cta-secondary { background: #eef1f3; color: var(--text); }

#sg-floating-cart-root { position: relative; z-index: 9998; }
.sg-floating-cart-btn {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  width: 58px; height: 58px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, var(--accent), #3f8f29); color: #fff;
  box-shadow: 0 16px 34px rgba(0,0,0,.26); display: flex; align-items: center; justify-content: center;
  overflow: visible; padding: 0; opacity: .55;
}
#sg-floating-cart-root.has-items .sg-floating-cart-btn { opacity: 1; }
.sg-floating-cart-icon { font-size: 26px; line-height: 1; }
.sg-floating-cart-count {
  position: absolute; right: -4px; top: -5px; min-width: 23px; height: 23px; padding: 0 6px;
  border-radius: 999px; background: #111a22; color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; z-index: 2;
}
.sg-floating-cart-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.18); z-index: 9997; }
.sg-floating-cart-drawer {
  position: fixed; right: 16px; bottom: 88px; z-index: 9998;
  width: min(430px, calc(100vw - 32px)); max-height: min(680px, calc(100vh - 112px));
  overflow: auto; overscroll-behavior: contain; background: #fff; color: var(--text);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 70px rgba(0,0,0,.28);
  padding: 16px; transform: translateY(14px); opacity: 0; pointer-events: none; transition: .18s ease;
}
.sg-floating-cart-drawer.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.sg-floating-cart-head {
  display: flex; justify-content: space-between; gap: 14px; align-items: flex-start;
  padding: 2px 4px 12px; border-bottom: 1px solid var(--line);
}
.sg-floating-cart-head strong { display: block; font-size: 18px; line-height: 1.1; }
.sg-floating-cart-head small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.sg-floating-cart-close {
  flex: 0 0 38px; width: 38px; height: 38px; border: 0; border-radius: 999px;
  background: #111a22; color: #fff; cursor: pointer; font-size: 24px; font-weight: 900;
  line-height: 1; display: flex; align-items: center; justify-content: center; margin: -2px -2px 0 0;
}
.sg-floating-cart-items { display: grid; gap: 10px; padding: 12px 0; }
.sg-floating-cart-empty { padding: 12px; border-radius: 14px; background: #f3f5f6; color: var(--muted); font-size: 14px; }
.sg-floating-cart-item {
  position: relative; display: grid; grid-template-columns: 40px minmax(0,1fr) auto 34px;
  gap: 10px; align-items: center; padding: 11px 8px 11px 12px;
  border: 1px solid var(--line); border-radius: 16px; background: #fbfcfd; min-width: 0;
}
.sg-floating-cart-item-thumb {
  width: 36px; height: 36px; object-fit: contain; display: block;
  background: #f7f8f9; border-radius: 8px; padding: 3px; box-sizing: border-box;
}
.sg-floating-cart-item-copy { min-width: 0; }
.sg-floating-cart-item-copy strong { display: block; font-size: 13px; line-height: 1.22; overflow-wrap: anywhere; }
.sg-floating-cart-item-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.15; }
.sg-floating-cart-item-price { font-size: 12px; font-weight: 800; white-space: nowrap; }
.sg-floating-cart-remove {
  width: 32px; height: 32px; min-width: 32px; border: 0; border-radius: 999px;
  background: #eef1f3; color: #27323a; cursor: pointer; font-size: 20px; font-weight: 900;
  line-height: 1; display: flex; align-items: center; justify-content: center;
}
.sg-floating-cart-remove:hover { background: #111a22; color: #fff; }
.sg-floating-cart-total {
  display: flex; justify-content: space-between; gap: 16px;
  border-top: 2px solid var(--line); padding: 12px 4px 0; font-weight: 900;
}
.sg-floating-cart-net { padding: 4px 4px 0; font-size: 12px; color: var(--muted); }
.sg-floating-cart-actions { display: grid; gap: 10px; margin-top: 12px; }
@media (max-width: 760px) {
  .sg-floating-cart-btn { right: 12px; bottom: 12px; width: 54px; height: 54px; }
  .sg-floating-cart-drawer {
    right: 10px; left: 10px; bottom: 78px; width: auto; max-height: calc(100vh - 98px);
    border-radius: 20px; padding: 14px;
  }
}

@media (max-width: 720px) {
  .brand-head { grid-template-columns: 1fr; }
  .brand-photo { width: 96px; height: 96px; }
}

/* =========================================================
   smartGRIP mikrogaleria + lightbox (max 5 zdjęć łącznie)
   ========================================================= */
.sg-gallery-wrap {
  position: relative;
  display: block;
  width: 100%;
  flex-shrink: 0;
}
.sg-gallery-wrap > img {
  display: block;
  width: 100%;
}
.sg-gallery-trigger {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 6;
  min-width: 24px;
  min-height: 24px;
  padding: 1px 3px;
  margin: 0;
  border: 0;
  border-radius: 0 0 0 6px;
  background: rgba(18, 24, 28, 0.82);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  box-shadow: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}
.sg-gallery-trigger:focus-visible {
  outline: 2px solid var(--accent, #5cb335);
  outline-offset: 2px;
}
.sg-gallery-loupe {
  width: 12px;
  height: 12px;
  border: 1.5px solid #fff;
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
}
.sg-gallery-loupe::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 2px;
  background: #fff;
  right: -5px;
  bottom: -1px;
  transform: rotate(45deg);
  border-radius: 1px;
}
.sg-gallery-plus {
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.sg-gallery-trigger-count {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.sg-card .sg-gallery-wrap,
.sg-part-card .sg-gallery-wrap {
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}
.sg-visual-card .sg-gallery-wrap {
  border-radius: 12px;
  overflow: hidden;
}
.sg-part-card--readyset .sg-gallery-wrap > img.sg-gallery-img-clickable {
  cursor: zoom-in;
}
.sg-gallery-wrap.has-gallery-readyset .sg-gallery-trigger {
  opacity: 1;
}

/* Pojedyncze elementy — mikrogaleria jak wcześniej (lupka widoczna, zdjęcie klikalne) */
#view-parts .sg-part-card:not(.sg-part-card--readyset) .sg-gallery-wrap {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #f7f8f9;
}
#view-parts .sg-part-card:not(.sg-part-card--readyset) .sg-gallery-wrap > img {
  width: 100% !important;
  height: 120px !important;
  flex: none !important;
  object-fit: contain;
  object-position: center;
  background: #f7f8f9;
  border-radius: 12px;
  padding: 8px;
}
#view-parts .sg-part-card:not(.sg-part-card--readyset) .sg-gallery-trigger {
  opacity: 1 !important;
  z-index: 10;
  pointer-events: auto;
}

body.sg-lightbox-open {
  overflow: hidden;
}
.sg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.sg-lightbox.is-open {
  display: flex;
}
.sg-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 16, 0.88);
}
.sg-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 920px);
  max-height: min(100dvh - 24px, 900px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.sg-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 48px 10px 16px;
  border-bottom: 1px solid #e8ecef;
  min-height: 0;
}
.sg-lightbox-title {
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-lightbox-counter {
  flex-shrink: 0;
  font-size: 12px;
  color: #667;
  font-weight: 600;
}
.sg-lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #f2f4f6;
  color: #223;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.sg-lightbox-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 4px;
  touch-action: pan-y pinch-zoom;
}
.sg-lightbox-figure {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-height: min(62dvh, 620px);
}
.sg-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: min(58dvh, 580px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.sg-lightbox-caption {
  margin: 8px 12px 0;
  font-size: 13px;
  color: #556;
  text-align: center;
  line-height: 1.35;
}
.sg-lightbox-nav {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: #eef1f4;
  color: #223;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.sg-lightbox-nav:disabled,
.sg-lightbox-nav[hidden] {
  visibility: hidden;
  pointer-events: none;
}
.sg-lightbox-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px 14px;
}
.sg-lightbox-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #c5ccd3;
}
.sg-lightbox-dot.is-active {
  background: var(--accent, #5cb335);
  width: 18px;
}


@media (max-width: 760px) {
  .sg-lightbox {
    padding: 0;
  }
  .sg-lightbox-panel {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
    min-height: 100dvh;
  }
  .sg-lightbox-stage {
    display: block;
    position: relative;
    padding: 4px 8px 0;
  }
  .sg-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  }
  .sg-lightbox-prev {
    left: 6px;
  }
  .sg-lightbox-next {
    right: 6px;
  }
  .sg-lightbox-figure {
    max-height: calc(100dvh - 160px);
  }
  .sg-lightbox-img {
    max-height: calc(100dvh - 190px);
  }
  .sg-gallery-trigger {
    min-width: 26px;
    min-height: 26px;
    padding: 1px 3px;
  }
}

#view-readysets .sg-part-card--readyset .sg-gallery-wrap,
.set-card .sg-gallery-wrap,
.set-thumb .sg-gallery-wrap {
  width: 100%;
  background: #fff;
}
#view-readysets .sg-part-card--readyset .sg-gallery-wrap > img,
.set-card .sg-gallery-wrap > img,
.set-thumb .sg-gallery-wrap > img {
  background: #fff !important;
}

