:root {
  --bg: #f5efe6;
  --surface: #fffaf3;
  --ink: #2b2420;
  --muted: #6b5f55;
  --accent: #b85c38;
  --accent-2: #3f6b5b;
  --border: #e2d6c6;
  --focus: #1f4e79;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

.site-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 16px; }
.mark {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 22px;
}
.site-header h1 { margin: 0; font-size: 28px; letter-spacing: 0.02em; }
.tagline { margin: 0; color: var(--muted); font-size: 14px; }

.layout { max-width: 1200px; margin: 0 auto; padding: 24px 32px 64px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: end;
  margin-bottom: 24px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; }
.field span { font-size: 13px; color: var(--muted); font-weight: 600; }
input[type="search"], select {
  padding: 10px 12px; font-size: 16px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--ink);
}
.saved-toggle {
  padding: 10px 16px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--ink); cursor: pointer;
}
.saved-toggle[aria-pressed="true"] {
  background: var(--accent-2); color: #fff; border-color: var(--accent-2);
}

.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.item-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.item-card img {
  width: 100%; height: 180px; object-fit: cover; display: block;
}
.item-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.item-body h2 { margin: 0; font-size: 20px; }
.meta { margin: 0; color: var(--muted); font-size: 14px; }
.price { margin: 0; font-weight: 600; }
.open-item {
  margin-top: auto; padding: 10px 14px; font-size: 15px; font-weight: 600;
  border: none; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer;
  align-self: flex-start;
}

.empty-state {
  text-align: center; padding: 48px 16px; color: var(--muted);
}
.empty-state button {
  margin-top: 12px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
}

.detail-dialog {
  border: none; padding: 0; border-radius: var(--radius);
  max-width: 640px; width: 92vw; max-height: 90vh; overflow: auto;
  background: var(--surface);
}
.detail-dialog::backdrop { background: rgba(0,0,0,0.45); }
.detail { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.detail img { width: 100%; height: 260px; object-fit: cover; border-radius: 10px; }
.detail-title { margin: 0; font-size: 24px; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); font-weight: 600; }
.details dd { margin: 0; }
.detail-body { margin: 0; }
.save-item, .close-detail {
  padding: 10px 16px; font-size: 15px; font-weight: 600;
  border-radius: 10px; cursor: pointer; border: 1px solid var(--border);
}
.save-item { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }
.close-detail { background: #fff; color: var(--ink); align-self: flex-start; }

:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 640px) {
  .site-header { padding: 16px; }
  .layout { padding: 16px; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
