:root {
  --brand: #e63946;
  --brand-dark: #c1121f;
  --dark: #1d3557;
  --ink: #22223b;
  --muted: #6c757d;
  --bg: #f8f9fa;
  --card: #ffffff;
  --border: #e9ecef;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.topbar {
  background: var(--dark);
  color: #fff;
  font-size: 13px;
  padding: 8px 0;
  text-align: center;
}
.topbar a { color: #fff; text-decoration: underline; }

header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.logo small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }

.searchbox {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  gap: 8px;
}
.searchbox input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 15px;
  outline: none;
  min-width: 0;
}
.searchbox button {
  border: 0;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
}

.cartbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--dark);
  font-size: 20px;
}
.cartbtn .count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.cartbtn .count.show { display: inline-flex; }

.announce {
  background: var(--brand);
  color: #fff;
  text-align: center;
  font-size: 13px;
  padding: 8px 12px;
}

.hero {
  background: linear-gradient(135deg, #1d3557 0%, #457b9d 100%);
  color: #fff;
  text-align: center;
  padding: 40px 16px 56px;
}
.hero h1 { font-size: 26px; margin-bottom: 8px; }
.hero p { opacity: 0.85; font-size: 15px; }

.hero-search {
  margin-top: 20px;
  display: flex;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  background: #fff;
  border-radius: 999px;
  overflow: hidden;
  padding: 4px;
}
.hero-search input {
  flex: 1;
  border: 0;
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
  min-width: 0;
}
.hero-search button {
  border: 0;
  background: var(--brand);
  color: #fff;
  padding: 0 24px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
}

.section { padding: 24px 0; }
.section h2 { font-size: 20px; color: var(--dark); margin-bottom: 16px; }

.grid-cats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.grid-cats a {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-weight: 600;
  color: var(--dark);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
}
.grid-cats a span:first-child {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

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

.card-prod {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease;
}
.card-prod:active { transform: scale(0.98); }
.card-prod .thumb {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #e9ecef, #f8f9fa);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-prod .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.card-prod .body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.card-prod .title {
  font-size: 13px;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.card-prod .code { font-size: 11px; color: var(--muted); }
.card-prod .price { font-size: 18px; font-weight: 800; color: var(--brand); }
.card-prod .old { font-size: 12px; color: var(--muted); text-decoration: line-through; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-dark { background: var(--dark); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--dark); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.product-page { padding: 16px; }
.product-page .thumb {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 16px;
}
.product-page .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 20px; }
.product-page h1 { font-size: 20px; margin-bottom: 4px; }
.product-page .code-line { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.product-page .price-line { font-size: 26px; font-weight: 800; color: var(--brand); margin-bottom: 16px; }
.qty-row { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
.qty-row button {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 20px;
  cursor: pointer;
}
.qty-row output { font-size: 18px; font-weight: 700; min-width: 32px; text-align: center; }
.meta { margin-top: 20px; font-size: 14px; color: var(--muted); display: grid; gap: 6px; }

.drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(420px, 92vw);
  height: 100%;
  background: var(--card);
  z-index: 100;
  transition: right 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}
.drawer.open { right: 0; }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h3 { font-size: 17px; }
.drawer-close { border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-foot { border-top: 1px solid var(--border); padding: 16px; display: grid; gap: 10px; }
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
  display: none;
}
.overlay.show { display: block; }

.cart-empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.cart-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-item .mini { width: 56px; height: 56px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cart-item .mini img { width: 100%; height: 100%; object-fit: contain; }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .info .t { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-item .info .p { font-size: 14px; font-weight: 700; color: var(--brand); margin-top: 2px; }
.cart-item .qty { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cart-item .qty button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font-size: 14px; }
.cart-item .qty span { min-width: 20px; text-align: center; font-weight: 600; font-size: 14px; }
.cart-item .remove { border: 0; background: transparent; color: var(--brand); font-size: 12px; cursor: pointer; align-self: flex-start; padding: 4px; }

.form { display: grid; gap: 12px; }
.form label { font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--card);
  font-family: var(--font);
}
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }

.checkout-summary { background: var(--bg); border-radius: var(--radius); padding: 14px; display: grid; gap: 6px; font-size: 14px; }
.checkout-summary .total { font-weight: 800; font-size: 18px; color: var(--dark); border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 4px; }

/* Order confirmation */
.order-ok { text-align: center; padding: 48px 16px; }
.order-ok .icon { font-size: 60px; margin-bottom: 8px; }
.order-ok h1 { font-size: 22px; margin-bottom: 8px; }
.order-ok .num { font-size: 15px; color: var(--muted); margin-bottom: 20px; }
.order-ok .wa { margin-top: 16px; }

.notice { background: #fff8e1; border: 1px solid #ffe29a; color: #7a5c00; border-radius: 10px; padding: 12px 14px; font-size: 14px; }

footer.site { background: var(--dark); color: #fff; padding: 24px 0; margin-top: 32px; font-size: 14px; }
footer.site .cols { display: grid; gap: 16px; }
footer.site h4 { margin-bottom: 8px; font-size: 14px; }
footer.site a { color: #cfd8e3; display: block; margin-bottom: 4px; }
footer.site .copy { text-align: center; opacity: 0.6; font-size: 12px; margin-top: 20px; }

.breadcrumb { font-size: 13px; color: var(--muted); padding: 12px 0; }
.breadcrumb a { color: var(--dark); }

.results-info { font-size: 14px; color: var(--muted); margin-bottom: 14px; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }

@media (min-width: 700px) {
  .grid-cats { grid-template-columns: repeat(4, 1fr); }
  .grid-prod { grid-template-columns: repeat(3, 1fr); }
  .card-prod .title { font-size: 14px; }
  .hero h1 { font-size: 34px; }
  footer.site .cols { grid-template-columns: repeat(3, 1fr); }
  .product-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
}

@media (min-width: 1024px) {
  .grid-prod { grid-template-columns: repeat(4, 1fr); }
}