:root {
  --green-900: #123f27;
  --green-700: #1f7a43;
  --green-500: #35a85a;
  --green-100: #e7f7ec;
  --yellow-200: #fff2a8;
  --yellow-500: #f5c542;
  --white: #ffffff;
  --ink: #142015;
  --muted: #66736a;
  --line: #dce8df;
  --shadow: 0 20px 55px rgba(18, 63, 39, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #f7fbf8;
}

button {
  font: inherit;
  cursor: pointer;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: var(--white);
  font-weight: 800;
  letter-spacing: 0;
  background: linear-gradient(145deg, var(--green-700), var(--green-500));
  box-shadow: 0 12px 28px rgba(31, 122, 67, 0.25);
}

.tagline,
.section-title p,
.cart-header p,
.hero p {
  margin: 0 0 4px;
  color: var(--green-700);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
}

.cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  color: var(--white);
  font-weight: 800;
  background: var(--green-700);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-toggle,
.install-toggle {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-900);
  font-weight: 800;
  background: var(--white);
}

.admin-toggle:hover {
  border-color: var(--green-700);
  background: var(--green-100);
}

.install-toggle {
  color: var(--white);
  border-color: var(--green-700);
  background: var(--green-700);
}

.install-toggle:hover {
  background: var(--green-900);
}

.cart-toggle span {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--green-900);
  background: var(--white);
}

.layout {
  padding: 28px clamp(16px, 4vw, 56px) 40px;
}

.hero {
  min-height: 260px;
  display: flex;
  align-items: end;
  margin-bottom: 34px;
  padding: clamp(24px, 5vw, 48px);
  border-radius: 8px;
  overflow: hidden;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(18, 63, 39, 0.88), rgba(18, 63, 39, 0.3)),
    url("https://images.unsplash.com/photo-1542838132-92c53300491e?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.hero-content {
  max-width: 660px;
}

.hero p {
  color: #baf2c8;
}

.hero h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.02;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.section-title span {
  color: var(--muted);
  font-weight: 700;
}

.deals-section {
  margin-bottom: 34px;
  padding: 22px;
  padding-right: 412px;
  border: 1px solid #ead370;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--yellow-200), #fff9d6);
}

.offers-grid,
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
}

.product-grid {
  padding-right: 390px;
}

.catalog-tools {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
  padding-right: 390px;
}

.search-box {
  display: grid;
  gap: 7px;
  color: var(--green-900);
  font-weight: 800;
}

.search-box input,
.admin-panel input,
.admin-panel select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

.search-box input:focus,
.admin-panel input:focus,
.admin-panel select:focus {
  outline: 3px solid rgba(53, 168, 90, 0.2);
  border-color: var(--green-500);
}

.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-buttons button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-900);
  font-weight: 800;
  background: var(--white);
}

.category-buttons button.active,
.category-buttons button:hover {
  border-color: var(--green-700);
  color: var(--white);
  background: var(--green-700);
}

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 10px 30px rgba(18, 63, 39, 0.08);
}

.offer-card {
  border-color: #e3c441;
  box-shadow: 0 12px 34px rgba(145, 118, 18, 0.13);
}

.product-image {
  position: relative;
  height: 168px;
  background: var(--green-100);
}

.discount-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--green-900);
  font-size: 0.78rem;
  text-transform: uppercase;
  background: var(--yellow-500);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  font-size: 4rem;
  background: var(--green-100);
}

.product-card.image-error .product-fallback {
  display: grid;
}

.product-card.image-error img {
  display: none;
}

.product-info {
  padding: 16px;
}

.product-info h3 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

.product-category {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.product-price {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: baseline;
  margin-bottom: 14px;
  color: var(--green-700);
  font-size: 1.2rem;
  font-weight: 900;
}

.old-price {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: line-through;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
}

.add-button,
.whatsapp-button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  font-weight: 900;
  background: var(--green-700);
}

.add-button:hover,
.cart-toggle:hover,
.whatsapp-button:hover {
  background: var(--green-900);
}

.cart {
  position: fixed;
  top: 88px;
  right: clamp(16px, 4vw, 56px);
  bottom: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.cart-header h2 {
  margin: 0;
}

.close-cart {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
}

.cart-items {
  flex: 1;
  overflow: auto;
  padding: 14px 18px;
}

.empty-cart {
  margin: 20px 0;
  color: var(--muted);
  text-align: center;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.cart-item h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.cart-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.quantity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-900);
  font-size: 1.2rem;
  font-weight: 900;
  background: var(--green-100);
}

.quantity span {
  min-width: 22px;
  text-align: center;
  font-weight: 900;
}

.cart-footer {
  padding: 18px;
  border-top: 1px solid var(--line);
  background: #fbfdfb;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 1.2rem;
}

.total-row strong {
  color: var(--green-700);
  font-size: 1.45rem;
}

.whatsapp-button {
  min-height: 54px;
  background: #25d366;
}

.whatsapp-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.overlay {
  display: none;
}

.admin-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(18, 63, 39, 0.42);
}

.admin-panel.open {
  display: flex;
}

.admin-card {
  width: min(980px, 100%);
  max-height: min(860px, 92vh);
  overflow: auto;
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.admin-header p {
  margin: 0 0 4px;
  color: var(--green-700);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-header h2 {
  margin: 0;
}

.close-admin {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
}

.admin-login,
.admin-content {
  padding: 18px;
}

.admin-login {
  display: grid;
  gap: 12px;
}

.admin-login label,
.product-form label {
  display: grid;
  gap: 7px;
  color: var(--green-900);
  font-weight: 800;
}

.admin-login button,
.product-form button,
.admin-product button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  font-weight: 900;
  background: var(--green-700);
}

#loginMessage {
  margin: 0;
  color: #b42318;
  font-weight: 800;
}

.product-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.full-field,
.form-actions {
  grid-column: 1 / -1;
}

.check-field {
  align-content: end;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

.form-actions {
  display: flex;
  gap: 10px;
}

.form-actions button {
  padding: 0 16px;
}

#clearForm {
  color: var(--green-900);
  border: 1px solid var(--line);
  background: var(--white);
}

.admin-products {
  display: grid;
  gap: 10px;
  padding-top: 18px;
}

.admin-product {
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-product img {
  width: 64px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--green-100);
}

.admin-product strong,
.admin-product span {
  display: block;
}

.admin-product span {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-product button {
  padding: 0 12px;
}

@media (max-width: 980px) {
  .deals-section,
  .catalog-tools,
  .product-grid {
    padding-right: 0;
  }

  .cart {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 92vw);
    border-radius: 0;
    transform: translateX(110%);
    transition: transform 0.25s ease;
  }

  .cart.open {
    transform: translateX(0);
  }

  .close-cart {
    display: block;
  }

  .overlay.show {
    position: fixed;
    inset: 0;
    z-index: 15;
    display: block;
    background: rgba(18, 63, 39, 0.35);
  }
}

@media (max-width: 620px) {
  .header {
    align-items: stretch;
    flex-direction: column;
  }

  .cart-toggle {
    justify-content: center;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .layout {
    padding-top: 18px;
  }

  .hero {
    min-height: 230px;
    align-items: center;
  }

  .section-title {
    align-items: start;
    flex-direction: column;
  }

  .catalog-tools,
  .product-form,
  .admin-product {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }
}
