:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --ink: #1d2b1f;
  --muted: #6b7a6e;
  --brand: #2e7d32;
  --brand-dark: #1b5e20;
  --warn: #f9a825;
  --danger: #c62828;
  --line: #e3e7e0;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 40, 20, 0.08);
}

* { box-sizing: border-box; }

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

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

.site-header {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  padding: 28px 0 22px;
}
.site-header h1 { margin: 0; font-size: 1.6rem; }
.tagline { margin: 4px 0 0; opacity: 0.9; font-size: 0.95rem; }

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

.lang-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 3px;
  flex-shrink: 0;
}
.lang-btn {
  border: none;
  background: transparent;
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.15s ease;
}
.lang-btn:hover { opacity: 1; }
.lang-btn.active { background: #fff; color: var(--brand-dark); opacity: 1; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.toolbar input[type="search"] {
  flex: 1 1 220px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.95rem;
  background: #fff;
}
.toolbar select {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.9rem;
}
.hide-soldout { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-wa:hover { background: #1eb856; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-danger { color: var(--danger); border-color: #f0c8c8; }

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding-bottom: 30px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.card.soldout { opacity: 0.65; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.available { background: #e6f4ea; color: var(--brand-dark); }
.badge.low { background: #fff6e0; color: #8d6e00; }
.badge.soldout { background: #fdecea; color: var(--danger); }
.card .desc { margin: 0; font-size: 0.85rem; color: var(--muted); flex: 1; }
.price { font-size: 1.15rem; font-weight: 700; color: var(--brand-dark); }
.price small { font-weight: 400; color: var(--muted); font-size: 0.75rem; }
.seller { font-size: 0.8rem; color: var(--muted); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Modals */
dialog {
  border: none;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { margin-top: 0; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; }
dialog input, dialog textarea, dialog select {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  width: 100%;
}
.row { display: flex; gap: 10px; }
.row label { flex: 1; }
.hint { margin: 0; font-size: 0.8rem; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.hidden { display: none !important; }

.pin-box { text-align: center; }
.pin-box code {
  display: block;
  font-size: 1.6rem;
  letter-spacing: 3px;
  background: var(--bg);
  border: 1px dashed var(--brand);
  border-radius: 10px;
  padding: 14px;
  margin: 14px 0;
  user-select: all;
}

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

@media (max-width: 560px) {
  .toolbar { position: static; }
  .row { flex-direction: column; gap: 12px; }
  .header-row { flex-direction: column; align-items: flex-start; }
}
