:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --dark: #111827;
  --soft: #f9fafb;
  --success: #0f8a3b;
  --warning: #b7791f;
  --danger: #b91c1c;
  --shadow: 0 14px 35px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #e8f7ee 0, #f4f5f7 32%, #f4f5f7 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 26px;
  background: var(--dark);
  color: white;
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
  color: #25d366;
}

.muted {
  margin: 0;
  color: #d1d5db;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge {
  background: #25d366;
  color: #062c14;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.catalog-card,
.cart-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.catalog-card {
  padding: 18px;
}

.cart-card {
  padding: 18px;
  position: sticky;
  top: 18px;
}

.status-box,
.empty-state {
  padding: 14px;
  border-radius: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-weight: 700;
}

.status-box.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.business-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.business-meta span {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-row {
  margin: 0 0 18px;
}

.search-row input,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--text);
  outline: none;
}

.search-row input {
  padding: 15px 16px;
  font-size: 1rem;
}

.search-row input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.14);
}

.category-section + .category-section {
  margin-top: 24px;
}

.category-section h2 {
  font-size: 1.1rem;
  margin: 0 0 12px;
}

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

.product-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 15px;
  min-height: 180px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
}

.product-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.product-card h3 {
  margin: 0;
  font-size: 1rem;
}

.product-card p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.price {
  display: inline-block;
  font-size: 1.18rem;
  margin-top: 4px;
}

.stock {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.stock.disponible {
  color: var(--success);
  background: #ecfdf3;
}

.stock.consultar {
  color: var(--warning);
  background: #fffbeb;
}

.stock.agotado {
  color: var(--danger);
  background: #fef2f2;
}

.qty-row {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
}

.qty-row button {
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--dark);
  color: white;
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
}

.qty-row button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.qty-row span {
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-weight: 900;
}

.cart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cart-header h2 {
  margin: 4px 0 0;
}

.pill {
  background: #ecfdf3;
  color: var(--success);
}

.cart-items {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  min-height: 70px;
  background: var(--soft);
}

.cart-items.empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.cart-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.cart-line:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cart-line div {
  display: grid;
  gap: 3px;
}

.cart-line span {
  color: var(--muted);
  font-size: 0.86rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.total-row strong {
  font-size: 1.45rem;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-weight: 800;
  font-size: 0.9rem;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 12px;
  font-weight: 500;
}

.optional {
  color: var(--muted);
  font-weight: 600;
}

.whatsapp-btn {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 16px;
  background: #25d366;
  color: #062c14;
  padding: 15px 16px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(37, 211, 102, 0.22);
}

.whatsapp-btn:hover {
  filter: brightness(0.97);
}

.small-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  margin-bottom: 0;
}

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

  .cart-card {
    position: static;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 1180px);
    padding: 9px 0 24px;
  }

  .topbar {
    border-radius: 20px;
    padding: 20px;
  }

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

  .topbar {
    flex-direction: column;
  }
}
