:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #2b2722;
  --muted: #7a7266;
  --line: #e7e2d8;
  --accent: #1f6f5c;
  --accent-2: #b4552d;
  --shadow: 0 1px 2px rgba(43, 39, 34, .06), 0 6px 18px rgba(43, 39, 34, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "IBM Plex Sans Thai", "Sarabun", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.container { width: min(1180px, 100% - 2rem); margin-inline: auto; }

/* ---------- header ---------- */
.site-header {
  background: linear-gradient(180deg, #14584a, #166349 60%, #1f6f5c);
  color: #fff;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: 1.1rem;
}
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.12rem; letter-spacing: .2px; }
.brand-text small { font-size: .78rem; color: #bfe3d7; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font-family: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 0; border-radius: 10px; padding: .6rem 1.1rem; font-size: .9rem;
  transition: transform .05s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-print {
  background: #ffd44d; color: #3d2f08;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.btn-print:hover { background: #ffe173; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: .8rem;
  margin: 1.6rem 0 1.4rem;
}
.search-box {
  flex: 1 1 260px; display: flex; align-items: center; gap: .5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: .55rem .8rem; color: var(--muted);
  box-shadow: var(--shadow);
}
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: .95rem; color: var(--ink);
}
.filter-box { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.filter-box select {
  font-family: inherit; font-size: .9rem; padding: .55rem .6rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  outline: none;
}
.result-count { font-size: .82rem; color: var(--muted); white-space: nowrap; margin-left: auto; }

/* ---------- grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
  padding-bottom: 2.5rem;
}
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(43, 39, 34, .1), 0 14px 30px rgba(43, 39, 34, .1); }
.card-img {
  aspect-ratio: 1 / 1;
  background: #f0ede5;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: .8rem .9rem 1rem; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .4rem; margin-bottom: .35rem; }
.card-name {
  margin: 0; font-size: .98rem; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.6em;
}
.badge {
  display: inline-block; flex: none;
  font-size: .68rem; font-weight: 600; letter-spacing: .2px;
  color: var(--accent); background: #e4f2ec; border: 1px solid #c5e2d7;
  border-radius: 999px; padding: .15rem .55rem; white-space: nowrap;
}
.badge.women { color: #8a3a5c; background: #f6e7ee; border-color: #ecceda; }
.card-price {
  font-size: 1.18rem; font-weight: 800; color: var(--accent-2); margin: .15rem 0 .25rem;
}
.card-price small { font-size: .72rem; font-weight: 600; color: var(--muted); margin-left: .15rem; }
.card-meta { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .78rem; color: var(--muted); }
.card-units { font-size: .7rem; color: var(--muted); }
.card-units:not(:empty)::before { content: "· "; }

/* ---------- empty state ---------- */
.empty { text-align: center; color: var(--muted); padding: 3rem 0 4rem; }
.empty p { margin: 0; }

.hidden { display: none !important; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(30, 26, 20, .5); }
.modal-card {
  position: relative; width: min(480px, 100%);
  background: var(--surface); border-radius: 18px; padding: 1.4rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
  max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: .7rem; right: .7rem; width: 32px; height: 32px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--muted); font-size: .85rem; cursor: pointer;
}
.modal-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.modal-id { font-family: Consolas, monospace; font-size: .72rem; color: var(--muted); }
.modal-img {
  aspect-ratio: 1 / 1; background: #f0ede5; border-radius: 12px; overflow: hidden; margin-bottom: .9rem;
}
.modal-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-card h2 { margin: 0 0 .3rem; font-size: 1.25rem; }
.modal-price { font-size: 1.5rem; font-weight: 800; color: var(--accent-2); margin-bottom: .9rem; }
.modal-details { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .8rem; margin: 0 0 .8rem; }
.modal-details div { background: var(--bg); border-radius: 10px; padding: .5rem .7rem; }
.modal-details dt { font-size: .72rem; color: var(--muted); }
.modal-details dd { margin: 0; font-size: .9rem; font-weight: 600; }
.modal-note, .modal-desc { font-size: .85rem; color: var(--muted); margin: .3rem 0 0; }
.modal-note { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem;
  padding: 1.2rem 0; background: var(--surface);
}

@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .brand-text small { display: none; }
  .result-count { width: 100%; margin-left: 0; }
}