:root {
  --bg: #f3f5f7;
  --ink: #1a1d21;
  --muted: #6b7280;
  --line: #e6e9ee;
  --card: #ffffff;
  --green: #22c55e;
  --green-dark: #16a34a;
  --green-soft: #e8f9ef;
  --orange: #f5a524;
  --orange-dark: #e89410;
  --shadow: 0 10px 28px rgba(17, 24, 39, 0.07);
  --radius: 16px;
  --font: "Manrope", "Segoe UI", sans-serif;
  --header-h: 72px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  background: var(--bg);
}

button, input { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 2rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-size: 0.95rem;
}

.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
  margin-left: auto;
  margin-right: 1rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.main-nav a:hover { color: var(--ink); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  color: var(--ink);
}

.region-btn .pin::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 2px;
}

.cart-icon-btn {
  position: relative;
  padding: 0.55rem;
  border-radius: 12px;
  color: var(--green-dark);
  border-color: #d1fae5;
  background: var(--green-soft);
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.region-wrap { position: relative; }

.region-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(420px, 90vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.85rem;
  z-index: 60;
}

.region-dropdown-title {
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.grid-regions {
  display: grid;
  gap: 0.5rem;
}

.region-card {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem;
  cursor: pointer;
}

.region-card:hover { border-color: var(--green); }
.region-card h3 { margin: 0 0 0.2rem; font-size: 0.95rem; }
.region-card p { margin: 0; color: var(--muted); font-size: 0.8rem; }
.region-card .stores { margin-top: 0.45rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip {
  font-size: 0.72rem;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}

/* —— Hero —— */
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.5rem 0.5rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.25;
  max-width: 18ch;
}

.hero-lead {
  margin: 0.85rem 0 0;
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.5;
}

/* —— Shop layout —— */
.shop {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 1.25rem;
  align-items: start;
}

.shop-main,
.aside-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.35rem;
}

.catalog-search {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}

.catalog-search input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: #fafbfc;
}

.catalog-search input:focus {
  outline: 2px solid #bbf7d0;
  border-color: var(--green);
}

.search-go {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.search-go:hover { background: var(--green-dark); }

.catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.catalog-titles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.catalog-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.catalog-count {
  color: var(--muted);
  font-weight: 700;
  font-size: 1.1rem;
}

.linkish {
  border: 0;
  background: none;
  color: var(--green-dark);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.brand-chip.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.brand-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #eee;
}

.brand-avatar img { width: 100%; height: 100%; object-fit: cover; }
.brand-avatar.all { font-size: 0.65rem; font-weight: 800; }

/* —— Groups / products grid —— */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.group-card,
.product-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 210px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.group-card {
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
}

.group-card:hover,
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.group-media,
.product-media {
  height: 120px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #f8fafc, #eef2f6);
  position: relative;
}

.group-media img,
.product-media img {
  max-width: 78%;
  max-height: 100px;
  object-fit: contain;
}

.group-body,
.product-body {
  padding: 0.75rem 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.group-body h3,
.product-body h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

.group-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.fav-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 0.95rem;
}

.fav-toggle.on { color: #ef4444; }

.btn-cart,
.qty-ctrl {
  margin-top: auto;
}

.btn-cart {
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}

.btn-cart:hover { background: var(--green-dark); }

.qty-ctrl {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.qty-ctrl button {
  border: 0;
  background: #f3f4f6;
  height: 36px;
  cursor: pointer;
  font-weight: 700;
}

.qty-ctrl span {
  text-align: center;
  font-weight: 700;
}

.status {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.status.error { color: #b91c1c; }

/* —— Cart aside —— */
.aside-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.aside-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.cart-n {
  color: var(--muted);
  font-weight: 700;
}

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 220px;
  overflow: auto;
  margin-bottom: 0.65rem;
}

.cart-empty,
.cart-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.cart-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  margin: 0 0 0.75rem;
  border-radius: 12px;
  background: var(--green-soft);
  border: 1px solid #86efac;
  font-weight: 700;
}

.cart-sum-row strong {
  font-size: 1.15rem;
  color: var(--green-dark);
}

.best-sum-banner {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.75rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #86efac;
}

.best-sum-banner strong {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink);
}

.best-sum-banner span,
.best-sum-banner div:first-child {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.best-sum-banner.empty {
  background: #f8fafc;
  border-color: var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.store-rank-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.store-rank-block.best {
  border-color: #86efac;
  background: var(--green-soft);
}

.store-rank-block .store-rank-row {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  grid-template-columns: 24px 40px 1fr auto 18px;
  text-align: left;
  font: inherit;
  color: inherit;
}

.store-rank-block .store-rank-row:hover {
  filter: brightness(0.98);
}

.chevron {
  color: var(--muted);
  font-size: 0.85rem;
}

.store-lines {
  padding: 0 0.7rem 0.7rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}

.cart-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.4rem;
  border-radius: 10px;
  background: #f8fafc;
}

.cart-item img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.cart-item h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.cart-item .meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.cart-item-price {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-find {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  margin-bottom: 1.1rem;
}

.btn-find:hover { background: var(--orange-dark); }
.btn-find:disabled { opacity: 0.65; cursor: wait; }

.results-block { margin-top: 0.25rem; }

.results-title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.results-placeholder {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.compare-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.store-rank {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.store-rank-row {
  display: grid;
  grid-template-columns: 24px 40px 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.store-rank-row.best {
  background: var(--green-soft);
  border-color: #86efac;
}

.store-rank-idx {
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}

.store-rank-row img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

.store-rank-meta .name {
  font-weight: 800;
  font-size: 0.88rem;
}

.store-rank-meta .tag {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.store-rank-price {
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
}

.found-products {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.found-products h4 {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.found-line {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0;
  border-top: 1px solid #f1f5f9;
}

.found-line:first-of-type { border-top: 0; }

.found-line img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
}

.found-line .fname {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}

.found-line .fprice {
  font-weight: 800;
  font-size: 0.88rem;
  white-space: nowrap;
}

.cart-item-price.muted { color: var(--muted); }

.compare-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.55rem;
  text-align: center;
  background: #fff;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.compare-card.best {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.compare-card img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 3px;
}

.compare-card .net-name {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-transform: uppercase;
}

.compare-card .net-price {
  font-size: 1.05rem;
  font-weight: 800;
  margin-top: auto;
}

.compare-card .net-tag {
  font-size: 0.68rem;
  opacity: 0.9;
}

.save-line {
  margin: 0.7rem 0 0;
  color: var(--green-dark);
  font-weight: 700;
  font-size: 0.88rem;
}

.btn-details {
  width: 100%;
  margin-top: 0.85rem;
  border: 0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.aside-widgets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 1rem;
}

.widget-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  border-radius: 12px;
  padding: 0.85rem 0.5rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.widget-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.widget-offers { background: #e8f1ff; color: #1e3a8a; }
.widget-bot { background: #eef2f6; color: #334155; }

/* —— Content sections —— */
.content-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.content-section h2 {
  margin: 0 0 1rem;
  font-size: 1.45rem;
  font-weight: 800;
}

.section-lead {
  margin: -0.4rem 0 1.25rem;
  color: var(--muted);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.steps article,
.promo-card,
.account-card,
.store-tile {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
  margin-bottom: 0.55rem;
}

.steps h3,
.promo-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.steps p,
.promo-card p,
.account-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.stores-grid,
.promo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.store-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.store-tile img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.store-tile h3 { margin: 0; font-size: 1rem; }
.store-tile p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.82rem; }

.account-card ul {
  margin: 1rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink);
}

/* —— Footer —— */
.site-footer {
  margin-top: 1rem;
  background: #fff;
  border-top: 1px solid var(--line);
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 1.6rem;
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.footer-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
}

.copyright {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.telegram-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.35);
  z-index: 70;
}

.telegram-fab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 55;
}

.details-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.details-sheet {
  width: min(720px, 100%);
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}

.details-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.details-head h3 { margin: 0; }

.detail-store {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0.7rem;
}

.detail-store.best { border-color: var(--green); background: #f0fdf4; }

.detail-line {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.4rem 0;
  border-top: 1px solid var(--line);
}

.detail-line:first-of-type { border-top: 0; }

.detail-line img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
}

.loyalty-tag {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
}

@media (max-width: 980px) {
  .main-nav { display: none; }
  .shop { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compare-rail { grid-template-columns: 1fr; }
  .steps,
  .stores-grid,
  .promo-grid { grid-template-columns: 1fr; }
  .aside-widgets { grid-template-columns: 1fr; }

  .shop-aside {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 94vw);
    height: 100vh;
    z-index: 60;
    transform: translateX(105%);
    transition: transform 0.22s ease;
    overflow: auto;
    padding: 0.75rem;
    background: transparent;
  }

  .shop-aside.open { transform: translateX(0); }

  .hero h1 { max-width: none; }
}
