:root {
  --bg: #faf7f2;
  --ink: #2b2420;
  --muted: #7a6f63;
  --accent: #c05a2b;
  --accent-dark: #9a4620;
  --card: #ffffff;
  --border: #e6ddd0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent-dark); }
.container { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.container.narrow { max-width: 480px; }

.nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; padding: 1rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--border); }
.nav .brand { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--ink); }
.nav nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nav nav a { text-decoration: none; color: var(--ink); }
.nav nav a:hover { color: var(--accent-dark); }

.flash { padding: 0.75rem 1.5rem; text-align: center; }
.flash.success { background: #e4f3e1; color: #285c1f; }
.flash.error { background: #fbe4e0; color: #8a2c1a; }

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.chip { padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--ink); background: var(--card); font-size: 0.9rem; }
.chip.active { background: var(--accent); color: white; border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--ink); display: block; transition: transform 0.1s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.thumb { aspect-ratio: 4/3; background: #f0ebe3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { color: var(--muted); font-size: 0.85rem; }
.thumb-placeholder.large { aspect-ratio: 4/3; width: 100%; }
.card-body { padding: 0.8rem; }
.card-body h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.price { font-weight: 700; color: var(--accent-dark); margin: 0 0 0.3rem; }
.price.big { font-size: 1.5rem; }
.meta { color: var(--muted); font-size: 0.85rem; margin: 0; }
.empty { color: var(--muted); padding: 2rem 0; }

.item-view { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.item-photo img { width: 100%; border-radius: 10px; }
.desc { white-space: pre-wrap; }
.seller { color: var(--muted); }
.back { display: inline-block; margin-bottom: 1rem; text-decoration: none; }

.buy-form { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-top: 1rem; }
.hint { color: var(--muted); font-size: 0.85rem; }
.status-badge { display: inline-block; padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600; }
.status-badge.reserved { background: #fdf0d5; color: #8a5a00; }
.status-badge.sold { background: #eee; color: #555; }

form.stack { display: flex; flex-direction: column; gap: 1rem; }
form.stack label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
input, select, textarea { padding: 0.6rem; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem; font-family: inherit; }
.btn { display: inline-block; padding: 0.6rem 1.2rem; border-radius: 8px; border: none; cursor: pointer; font-size: 1rem; text-decoration: none; background: #eee; color: var(--ink); }
.btn.primary { background: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn.active { background: var(--accent); color: white; }
.period-toggle { display: flex; gap: 0.5rem; }
.link-btn { background: none; border: none; color: var(--accent-dark); cursor: pointer; text-decoration: underline; padding: 0; font-size: inherit; }
.link-btn.danger { color: #a02c1a; }
.inline { display: inline; }

.row-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.table { width: 100%; border-collapse: collapse; margin: 1rem 0 2rem; background: var(--card); }
.table th, .table td { padding: 0.6rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem; }
.thumb-cell img { width: 50px; height: 50px; object-fit: cover; border-radius: 4px; }
.actions { display: flex; gap: 0.6rem; align-items: center; }
.status-pill { padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; background: #eee; }
.status-pill.available { background: #e4f3e1; color: #285c1f; }
.status-pill.reserved { background: #fdf0d5; color: #8a5a00; }
.status-pill.sold { background: #ddd; color: #444; }
.status-pill.removed { background: #fbe4e0; color: #8a2c1a; }
.preview { max-width: 200px; border-radius: 8px; }

@media (min-width: 700px) {
  .item-view { grid-template-columns: 1fr 1fr; }
}
