:root {
  --bg: #f3f1ec;
  --ink: #1c1b19;
  --muted: #6b6760;
  --line: #d9d4cb;
  --panel: #fffcf7;
  --accent: #0f5c4c;
  --accent-soft: #e4f2ee;
  --accent-2: #c45c26;
  --danger: #9b2c2c;
  --shadow: 0 12px 40px rgba(28, 27, 25, 0.08);
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html {
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden !important;
  background: var(--bg);
}
body {
  margin: 0 auto !important;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(15, 92, 76, 0.12), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(196, 92, 38, 0.10), transparent 55%),
    var(--bg);
  min-height: 100vh;
  width: 95% !important;
  max-width: 95% !important;
  overflow-x: hidden !important;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
}

a { color: inherit; text-decoration: none; }
.wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: max(0.85rem, env(safe-area-inset-left));
  padding-right: max(0.85rem, env(safe-area-inset-right));
}
.muted { color: var(--muted); }
.error { color: var(--danger); }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.9);
  backdrop-filter: blur(8px);
  position: relative;
  top: auto;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.45rem 0;
  min-width: 0;
}
.brand {
  font-weight: 750;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  min-width: 0;
  flex: 1 1 auto;
  width: min(168px, calc(100% - 7.25rem));
  max-width: calc(100% - 7.25rem);
}
.brand-logo {
  height: 44px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}
@media (min-width: 1081px) {
  .site-header .wrap {
    padding: 0.9rem 0;
  }
  .brand {
    width: 280px;
    max-width: 280px;
    flex: 0 0 auto;
  }
  .brand-logo {
    height: 82px;
  }
}
.brand:hover { text-decoration: none; }
.site-header nav a {
  font-size: 0.95rem;
  color: var(--muted);
  margin-left: 1rem;
}
.site-header nav a.active,
.site-header nav a:hover { color: var(--accent); }

.hero-calc {
  padding: 1.35rem 0 1rem;
  max-width: 38rem;
}
.hero-kicker {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero-calc h1 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.45rem, 6vw, 2.55rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 750;
}
.hero-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}
@media (min-width: 561px) {
  .hero-calc {
    padding: 2.75rem 0 1.75rem;
  }
  .hero-lead {
    font-size: 1.05rem;
  }
}

.catalog-groups { padding-bottom: 3rem; }
.cat-group { margin-bottom: 2rem; }
.cat-group h2 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.45rem;
}
.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 520px) {
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 820px) {
  .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.cat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
  padding: 0;
}
.cat-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.cat-card.disabled {
  opacity: 0.55;
  pointer-events: none;
  box-shadow: none;
}
.cat-card-media {
  aspect-ratio: 4 / 3;
  background: #e8e4dc;
  overflow: hidden;
}
.cat-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cat-card-placeholder {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(15,92,76,0.12), transparent 55%),
    #e8e4dc;
}
.cat-card-body {
  padding: 0.95rem 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.cat-card-body span { color: var(--muted); font-size: 0.9rem; }

.calculator-page {
  padding: 1.5rem 0 3rem;
}

.calc-product-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  align-items: start;
}
.calc-product-media {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 3;
}
.calc-product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.calc-product-placeholder {
  width: 100%;
  height: 100%;
  min-height: 180px;
  background:
    linear-gradient(135deg, rgba(15,92,76,0.12), transparent 55%),
    #e8e4dc;
}
.calc-product-copy {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem 1.4rem;
}
.calc-product-copy h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  line-height: 1.15;
}
.product-description {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}
.product-description p { margin: 0 0 0.85rem; }
.product-description ul {
  margin: 0 0 0.85rem;
  padding-left: 1.15rem;
}
.product-description li { margin: 0.25rem 0; }
.product-description p:last-child { margin-bottom: 0; }

.calculator-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

.calc-panel,
.price-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.calc-panel { padding: 1.35rem 1.35rem 1.1rem; }
.calc-head h2 { margin: 0 0 0.35rem; font-size: 1.2rem; }
.calc-head p { margin: 0 0 1.2rem; }

.calc-form {
  display: grid;
  gap: 0.65rem;
}
.field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
  align-items: center;
}
.field[hidden] { display: none !important; }
.field label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.field select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b6760' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 0.9rem center;
  border-radius: 10px;
  padding: 0.7rem 2.2rem 0.7rem 0.85rem;
  font: inherit;
  color: var(--ink);
}
@media (min-width: 561px) {
  .field {
    grid-template-columns: minmax(140px, 34%) 1fr;
    gap: 0.75rem;
  }
}
.field select:focus {
  outline: 2px solid rgba(15, 92, 76, 0.35);
  border-color: var(--accent);
}
.field select:disabled {
  background-color: #f0ebe3;
  color: #9a958c;
}

.calc-status {
  min-height: 1.25rem;
  margin: 1rem 0 0;
  font-size: 0.9rem;
}

.price-panel { position: static; }

@media (min-width: 821px) {
  .calc-product-hero {
    grid-template-columns: minmax(0, 0.9fr) 1.2fr;
  }
  .calculator-layout {
    grid-template-columns: 1.4fr 0.8fr;
  }
  .price-panel { position: sticky; top: 5rem; }
}
.price-card { padding: 1.4rem; }
.price-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
}
.price-total {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 750;
  color: var(--accent);
  margin: 0.35rem 0 0.5rem;
  line-height: 1.1;
}
.price-breakdown { font-size: 0.92rem; line-height: 1.45; }
.matched-product {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.calc-product-thumbs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.65rem 0 0;
}
.calc-thumb {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  width: 72px;
  height: 54px;
}
.calc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.calc-thumb:focus {
  outline: 2px solid rgba(15, 92, 76, 0.35);
}

