:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #221c17;
  --muted: #7a6f63;
  --border: #ece5dc;
  --accent: #b8873d;
  --accent-ink: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(34, 28, 23, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --surface: #211c16;
    --ink: #f4efe8;
    --muted: #a89a89;
    --border: #362f26;
    --accent: #d9a75b;
    --accent-ink: #201803;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
}
.brand h1 { font-size: 1.05rem; margin: 0; font-weight: 700; }

.vendor-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.search {
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
}
.search:focus { outline: 2px solid var(--accent); }

.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-3px); }

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--bg);
}

.card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.card-name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
}

.card-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 30px 20px 40px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  padding: 22px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.muted { color: var(--muted); font-size: 0.88rem; }

.modal-card label {
  display: block;
  margin-top: 14px;
  font-size: 0.85rem;
  font-weight: 600;
}
.modal-card input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  cursor: pointer;
  flex: 1;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.btn-block { width: 100%; }

.product-card-modal {
  max-width: 480px;
  padding: 0;
  overflow: hidden;
}
.product-card-modal img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.product-modal-info {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.price-row { margin: 6px 0 4px; }
.price { font-size: 1.6rem; font-weight: 800; }

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
}
