:root {
  --green: #0066cc;
  --green-dark: #004f9e;
  --green-soft: #e8f4fd;
  --ink: #152438;
  --muted: #6b7787;
  --line: #dce6f1;
  --bg: #ffffff;
  --card: #ffffff;
  --danger: #ff3b30;
  --accent: #ffcf3d;
  --whatsapp: #18a957;
  --buy: #00a86b;
  --buy-dark: #008d5a;
  --buy-soft: #e6fff4;
  --shadow: 0 16px 42px rgba(0, 102, 204, 0.16);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 36px);
  background: linear-gradient(135deg, #0066cc 0%, #0084e8 58%, #004f9e 100%);
  color: white;
  box-shadow: 0 6px 18px rgba(0, 102, 204, 0.24);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1.05;
}

.topbar p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.82);
}

.cart-button {
  min-width: 108px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.14);
  color: white;
}

.cart-button strong {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  margin-left: 8px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 28px) 148px;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  box-shadow: 0 1px 2px rgba(15, 45, 78, 0.04);
}

#categorySelect {
  display: none;
}

.search-box,
.checkout-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input,
.search-panel select,
.checkout-form input,
.checkout-form select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

.search-box input:focus,
.search-panel select:focus,
.checkout-form input:focus,
.checkout-form select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11, 60, 93, 0.14);
}

.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  border: 1px solid #bfd2dc;
  border-radius: 10px;
  padding: 18px;
  background: linear-gradient(135deg, #0066cc 0%, #0084e8 60%, #004f9e 100%);
  color: white;
  box-shadow: 0 12px 30px rgba(11, 60, 93, 0.2);
}

.home-hero strong,
.home-hero span {
  display: block;
}

.home-hero strong {
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.05;
}

.home-hero span {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
}

.home-hero button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

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

.category-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: white;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 4px 14px rgba(15, 45, 78, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.category-card:hover {
  border-color: #b5cee7;
  box-shadow: 0 10px 24px rgba(15, 45, 78, 0.1);
  transform: translateY(-1px);
}

.category-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 16px;
  font-weight: 900;
}

.category-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: normal;
}

.category-card strong {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.category-chevron {
  color: var(--green);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.category-card.active {
  border-color: var(--green);
  background: linear-gradient(180deg, #ffffff 0%, var(--green-soft) 100%);
}

.category-detail {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.category-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.category-detail-head h2 {
  margin: 0;
  color: var(--green);
  font-size: clamp(24px, 5vw, 34px);
  text-align: center;
}

.category-detail-head button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.category-detail > p {
  margin: 0;
  padding: 12px 18px;
  color: var(--muted);
  font-weight: 800;
}

.subcategory-list {
  display: grid;
}

.subcategory-block {
  border-top: 1px solid var(--line);
}

.subcategory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 64px;
  border: 0;
  padding: 0 18px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.subcategory-row span {
  font-size: 20px;
  font-weight: 700;
}

.subcategory-row strong {
  color: var(--green);
}

.segment-list {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
  background: #eef6fd;
}

.segment-list button {
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 500;
}

.segment-list button:first-child {
  color: var(--green);
  font-weight: 900;
  text-transform: uppercase;
}

.segment-list small {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 800;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 10px;
  color: var(--muted);
  font-weight: 700;
}

.status-row.compact {
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 12px;
}

.product-image-wrap {
  position: relative;
  width: 118px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

.product-image-wrap img {
  width: 118px;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #f8faf9;
}

.product-image-wrap.uses-fallback img {
  background: #fff8d6;
}

.illustrative-label {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: 7px;
  display: none;
  border-radius: 999px;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.9);
  color: #5b6570;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  box-shadow: 0 1px 5px rgba(15, 45, 78, 0.12);
}

.product-image-wrap.uses-fallback .illustrative-label {
  display: block;
}

.promo-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  border-radius: 6px;
  padding: 3px 7px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(227, 6, 19, 0.3);
}

.original-price {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  text-decoration: line-through;
}

.promo-price {
  color: var(--danger);
}

.product-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  min-height: 172px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(15, 45, 78, 0.06);
}

.product-info {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-width: 0;
}

.product-name {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.chip {
  border-radius: 6px;
  padding: 4px 6px;
  background: var(--green-soft);
  color: #53626e;
  font-size: 12px;
  font-weight: 700;
}

.promo-chip {
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff0c4;
  color: #8a5200;
  font-size: 12px;
  font-weight: 900;
}

.promo-card {
  border-color: #ffd666;
}

.price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  align-self: end;
  gap: 8px;
  margin-top: auto;
}

.price-block {
  display: grid;
  gap: 2px;
}

.price-block span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.price-block em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  text-decoration: line-through;
}

.price {
  color: var(--danger);
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
}

.add-button,
.send-button,
.pager button {
  border: 0;
  border-radius: 8px;
  color: white;
  font-weight: 800;
}

.add-button {
  min-height: 42px;
  padding: 0 16px;
  width: 100%;
  white-space: normal;
  background: linear-gradient(135deg, var(--buy) 0%, var(--buy-dark) 100%);
  box-shadow: 0 8px 18px rgba(59, 122, 87, 0.22);
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.add-button:hover {
  background: linear-gradient(135deg, #00bd78 0%, var(--buy-dark) 100%);
  box-shadow: 0 10px 22px rgba(59, 122, 87, 0.28);
}

.add-button:active {
  transform: translateY(1px);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}

.pager button {
  min-width: 110px;
  min-height: 42px;
  background: var(--green);
}

.pager button:disabled {
  cursor: default;
  background: #cfdad5;
  color: #6f8179;
}

.floating-cart {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: min(420px, calc(100vw - 28px));
  min-height: 62px;
  border: 0;
  border-radius: 999px;
  padding: 10px 12px 10px 18px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  background: var(--ink);
  color: white;
  box-shadow: 0 16px 38px rgba(8, 21, 16, 0.28);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 28;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: min(520px, calc(100vw - 24px));
  transform: translateX(-50%);
  border: 1px solid rgba(11, 60, 93, 0.16);
  border-radius: 999px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(15, 45, 78, 0.16);
  backdrop-filter: blur(14px);
}

.bottom-nav-item {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.bottom-nav-item span {
  font-size: 18px;
  line-height: 1;
}

.bottom-nav-item strong {
  font-size: 12px;
}

.bottom-nav-item.active {
  background: var(--green);
  color: white;
}

.bottom-nav-item em {
  position: absolute;
  top: 4px;
  right: 18%;
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 11px;
  font-style: normal;
}

.bottom-nav-item:not(.has-items) em {
  display: none;
}

.floating-cart.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.floating-cart span {
  display: grid;
  min-width: 0;
  text-align: left;
}

.floating-cart strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-cart small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  font-weight: 800;
}

.floating-cart em {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--ink);
  font-style: normal;
  font-weight: 900;
}

.floating-cart.pulse em {
  animation: cartPulse 0.34s ease;
}

@keyframes cartPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.cart-drawer.open {
  pointer-events: auto;
}

.cart-backdrop {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(8, 21, 16, 0.46);
  transition: opacity 0.18s ease;
}

.cart-drawer.open .cart-backdrop {
  opacity: 1;
}

.cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  height: 100%;
  padding: 18px;
  overflow-y: auto;
  transform: translateX(100%);
  background: white;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

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

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-head h2 {
  margin: 0;
  font-size: 24px;
}

.cart-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.cart-items {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  margin: 16px 0;
  max-height: min(38vh, 330px);
  min-height: 120px;
  overflow-y: auto;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

.cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfc;
}

.cart-item > div:first-child {
  min-width: 0;
}

.cart-item h3 {
  margin: 0 0 5px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.cart-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.cart-promo {
  color: #8a5200 !important;
  font-weight: 900;
}

.qty-controls {
  display: grid;
  grid-template-columns: 34px 34px 34px;
  align-items: center;
  gap: 4px;
}

.qty-controls button {
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 900;
}

.qty-controls span {
  text-align: center;
  font-weight: 900;
}

.checkout-form {
  display: grid;
  flex: 0 0 auto;
  gap: 12px;
  margin-top: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.checkout-title {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  padding: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
}

.checkout-title span {
  font-size: 18px;
  font-weight: 900;
}

.checkout-title small {
  color: var(--muted);
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.legal-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  padding: 14px;
  background: var(--green);
  color: white;
}

.cart-total strong {
  font-size: 24px;
}

.send-button {
  min-height: 50px;
  background: var(--whatsapp);
  box-shadow: 0 10px 22px rgba(24, 169, 87, 0.2);
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 34px 16px;
  background: white;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.cart-empty {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 360px;
  border-radius: 8px;
  padding: 28px 18px;
  background: #f7f9fc;
  color: var(--muted);
  text-align: center;
}

.cart-empty-icon {
  display: grid;
  width: 118px;
  height: 86px;
  place-items: center;
  border: 4px solid #2a91dd;
  border-radius: 22px;
  color: #2a91dd;
  font-weight: 900;
}

.cart-empty h3 {
  margin: 0;
  color: var(--green);
  font-size: 28px;
  line-height: 1.1;
}

.cart-empty p {
  margin: 0;
  max-width: 300px;
  font-size: 16px;
  line-height: 1.35;
}

.cart-empty button {
  min-height: 46px;
  border: 2px solid #2a91dd;
  border-radius: 8px;
  padding: 0 20px;
  background: white;
  color: #2a91dd;
  font-weight: 900;
}

@media (max-width: 920px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
    padding-top: calc(14px + env(safe-area-inset-top));
  }

  .topbar h1 {
    font-size: 23px;
  }

  .topbar p {
    font-size: 13px;
  }

  .cart-button {
    flex: 0 0 auto;
    min-width: 92px;
    padding: 9px 10px;
  }

  .cart-button span {
    display: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .home-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .home-hero button {
    width: 100%;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    gap: 10px;
  }

  .category-detail-head {
    grid-template-columns: 1fr auto;
    padding: 14px;
  }

  .category-detail-head h2 {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: left;
  }

  .category-detail-head button:first-child {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .category-detail-head button:last-child {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .subcategory-row {
    min-height: 58px;
  }

  .subcategory-row span {
    font-size: 18px;
  }

  .category-card {
    min-height: 70px;
    padding: 12px;
  }

  .category-icon {
    width: 32px;
    height: 32px;
  }

  .category-name {
    font-size: 14px;
  }

  .product-card {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
    min-height: 172px;
    padding: 10px;
  }

  .product-image-wrap {
    width: 112px;
  }

  .product-image-wrap img {
    width: 112px;
  }

  .product-name {
    min-height: 38px;
    font-size: 15px;
  }

  .price {
    font-size: 22px;
  }

  .add-button {
    min-height: 44px;
    font-size: 15px;
  }

  .floating-cart {
    left: 12px;
    right: 12px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    width: auto;
  }

  .cart-panel {
    padding: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .cart-item {
    grid-template-columns: 1fr;
  }

  .qty-controls {
    grid-template-columns: 42px 42px 42px;
    justify-content: end;
  }

}
