:root {
  --ink: #171717;
  --muted: #666a73;
  --line: #e5e0d6;
  --paper: #fbfaf7;
  --white: #fff;
  --lime: #c9f24a;
  --coral: #ff745c;
  --blue: #1f6feb;
  --dark: #20242b;
  --soft: #f1eee7;
  --shadow: 0 24px 60px rgba(17, 24, 39, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(18px, 4vw, 54px);
  background: rgba(251, 250, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand, .nav, .header-actions, .hero-actions, .filters, .catalog-toolbar, .drawer-head, .total, .order-actions, .contact-actions {
  display: flex;
  align-items: center;
}

.brand { gap: 10px; font-weight: 800; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--white);
  background: var(--dark);
  border-radius: 8px;
}

.nav { gap: 20px; color: var(--muted); font-size: 15px; }
.nav a:hover { color: var(--ink); }
.header-actions { gap: 10px; }

.account-btn, .cart-btn, .icon-btn, .secondary-link, .as-button, .order-link, .logout-btn, .contact-link, .contact-lead-form button, .auth-link {
  border: 0;
  cursor: pointer;
}

.account-btn, .cart-btn {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.account-btn {
  padding: 0 18px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
}

.account-btn.logged {
  color: var(--white);
  background: var(--blue);
  border-color: var(--blue);
}

.cart-btn {
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  color: var(--ink);
  background: var(--lime);
  border: 1px solid #b8db3b;
  box-shadow: 0 10px 24px rgba(103, 128, 22, 0.12);
}

.account-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(32, 36, 43, 0.12); }

.cart-btn:hover {
  transform: translateY(-1px);
  background: #d6ff55;
  box-shadow: 0 14px 30px rgba(103, 128, 22, 0.16);
}

.cart-word {
  font-size: 15px;
  line-height: 1;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 22px;
}

main { overflow: hidden; }

.hero {
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: center;
  gap: clamp(30px, 5vw, 72px);
  padding: clamp(36px, 6vw, 82px) clamp(18px, 4vw, 54px) 34px;
  background:
    linear-gradient(115deg, rgba(201, 242, 74, 0.48), transparent 36%),
    linear-gradient(225deg, rgba(255, 116, 92, 0.2), transparent 34%),
    var(--paper);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 13px;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.95;
}

h2 { font-size: clamp(30px, 4vw, 54px); line-height: 1; margin-bottom: 12px; }

.lead {
  max-width: 650px;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.5;
}

.hero-actions { gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.primary-link, .secondary-link, .order-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-link { color: var(--white); background: var(--dark); }
.secondary-link { color: var(--ink); background: var(--white); border: 1px solid var(--line); }

.hero-product { display: grid; gap: 14px; min-height: 480px; }

.hero-card {
  min-height: 150px;
  display: flex;
  align-items: flex-end;
  padding: 22px;
  color: var(--white);
  background: linear-gradient(145deg, #20242b, #3f4650);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.hero-card.large {
  min-height: 260px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  background:
    radial-gradient(circle at 70% 28%, rgba(201, 242, 74, 0.95), transparent 0 17%, transparent 18%),
    linear-gradient(145deg, #15171c, #343b43);
  font-size: 30px;
}

.hero-card.large strong { color: var(--lime); font-size: 20px; margin-top: 8px; }
.hero-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.hero-card.accent { background: linear-gradient(145deg, var(--coral), #ba3e31); }

.stats, .catalog-section, .contacts {
  padding: clamp(34px, 6vw, 76px) clamp(18px, 4vw, 54px);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--dark);
  color: var(--white);
}

.stats div {
  padding: 22px;
  background: #2b3038;
  border-radius: 8px;
}

.stats strong { display: block; font-size: 28px; color: var(--lime); }
.stats span { color: #c9ced8; }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
}

.search { display: grid; gap: 8px; min-width: min(380px, 100%); color: var(--muted); }
.search input, .lead-form input, .lead-form textarea, .checkout-fields input, .checkout-fields textarea, .contact-lead-form input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
}

.filters { gap: 8px; overflow-x: auto; padding-bottom: 10px; }

.filter-btn {
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.filter-btn.active { background: var(--lime); border-color: var(--lime); font-weight: 800; }

.catalog-toolbar { justify-content: space-between; margin: 10px 0 18px; color: var(--muted); }
select { max-width: 240px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 26px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 8px;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.empty-state p {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.product-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-art {
  aspect-ratio: 1.08;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #edf4ff, #fff4df);
  font-size: 44px;
  font-weight: 900;
}

.product-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-meta { display: grid; gap: 5px; }
.product-meta h3 { margin: 0; font-size: 17px; line-height: 1.2; }
.product-meta span { color: var(--muted); font-size: 14px; }
.product-buy { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.product-buy strong { font-size: 18px; }
.product-buy button { min-height: 40px; border-radius: 8px; border: 0; background: var(--dark); color: var(--white); padding: 0 12px; cursor: pointer; }

.contacts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 30px;
  background: var(--white);
  border-top: 1px solid var(--line);
}
.contacts p { max-width: 720px; color: var(--muted); line-height: 1.6; }

.contact-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: min(620px, 100%);
}

.contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 8px;
  color: var(--white);
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.14);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.contact-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(17, 24, 39, 0.18);
}

.contact-link.telegram { background: #1687ff; }
.contact-link.whatsapp { background: #18b263; }

.contact-lead-form {
  display: flex;
  gap: 8px;
  min-width: min(360px, 100%);
}

.contact-lead-form input {
  min-height: 54px;
  min-width: 190px;
}

.contact-lead-form button {
  min-height: 54px;
  padding: 0 18px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--lime);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 14px 30px rgba(103, 128, 22, 0.14);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  justify-content: flex-end;
  background: rgba(20, 24, 31, 0.42);
}

.drawer.open { display: flex; }

.drawer-panel {
  width: min(500px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--paper);
  padding: 22px;
  box-shadow: var(--shadow);
}

.drawer-head { justify-content: space-between; margin-bottom: 20px; }
.drawer-head h2 { font-size: 30px; margin: 0; }

.cart-items, .order-box, .lead-form, .checkout-fields, .social-auth { display: grid; gap: 12px; }

.cart-row, .account-card, .order-box {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 8px;
}

.cart-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.cart-row p, .account-card p, .order-box p { color: var(--muted); margin-bottom: 0; line-height: 1.45; }

.account-contact-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.account-contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--white);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.12);
}

.account-contact-link.telegram { background: #1687ff; }
.account-contact-link.vk { background: #0077ff; }

.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--white); border-radius: 8px; cursor: pointer; }

.kind-toggle { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 10px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #f6f4ef; }
.kind-toggle button { min-width: 82px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.kind-toggle button.active { background: var(--ink); color: var(--white); }

.total { justify-content: space-between; font-size: 20px; margin: 18px 0; }

.order-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.order-actions .order-link {
  width: 100%;
  min-width: 0;
  min-height: 60px;
  padding: 0 10px;
  text-align: center;
  white-space: normal;
  line-height: 1.08;
}

.order-link.call {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.order-link.telegram { color: var(--white); background: var(--blue); }
.order-link.whatsapp { color: var(--white); background: #24a865; }
.order-link.call { color: var(--ink); background: var(--white); border: 1px solid var(--line); }
.order-link.call.active { background: var(--lime); border-color: var(--lime); }
.order-link.crm { color: var(--ink); background: var(--lime); }
.order-link.disabled { pointer-events: none; opacity: 0.45; }

.social-auth { margin-top: 8px; }

.auth-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 8px;
  color: var(--white);
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.14);
}

.auth-link.telegram { background: #1687ff; }
.auth-link.vk { background: #0077ff; }

.lead-form label { display: grid; gap: 8px; color: var(--muted); }
textarea { min-height: 90px; resize: vertical; }

.logout-btn {
  display: none;
  width: 100%;
  min-height: 46px;
  margin-top: 14px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  font-weight: 800;
}

.logout-btn.visible { display: block; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(140%);
  z-index: 70;
  padding: 13px 16px;
  border-radius: 8px;
  color: var(--white);
  background: var(--dark);
  transition: transform 0.2s ease;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 1000px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; min-height: auto; }
}

@media (max-width: 720px) {
  .topbar { align-items: stretch; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .section-head { align-items: stretch; flex-direction: column; }
  .stats, .product-grid { grid-template-columns: 1fr 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .header-actions { width: 100%; }
  .account-btn, .cart-btn { flex: 1; }
  .contacts { grid-template-columns: 1fr; }
  .contact-actions { justify-content: flex-start; min-width: 0; }
  .contact-lead-form { width: 100%; }
  .contact-lead-form input { flex: 1; min-width: 0; }
  h1 { font-size: 44px; }
}

@media (max-width: 520px) {
  .contact-lead-form { flex-direction: column; }
  .contact-lead-form button { width: 100%; }
  .account-contact-actions { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats, .product-grid { grid-template-columns: 1fr; }
  .hero-card.large { font-size: 24px; }
}

.checkout-fields { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; }
.checkout-fields label { display: grid; gap: 8px; color: var(--muted); }
