:root {
  --bg: #0f1117;
  --surface: #171a23;
  --surface-2: #1f232e;
  --border: #2a2f3d;
  --text: #e8e9ed;
  --text-muted: #9096a8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --danger: #ef4444;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 520px; }

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--text); }
.main-nav { display: flex; align-items: center; gap: 20px; }
.main-nav a { color: var(--text-muted); font-size: 14px; }
.main-nav a:hover { color: var(--text); }
.nav-user { color: var(--text-muted); font-size: 14px; }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  text-decoration: underline;
}
.link-btn:hover { color: var(--danger); }
.inline-form { display: inline; }

.hero { padding: 56px 0 32px; text-align: center; }
.hero h1 { font-size: 32px; margin-bottom: 8px; }
.hero p { color: var(--text-muted); }

.category-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.category-bar a {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.category-bar a.active, .category-bar a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s;
}
.product-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.product-thumb { aspect-ratio: 16/10; background: var(--surface-2); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; color: var(--text-muted);
}
.thumb-placeholder.large { aspect-ratio: 16/9; border-radius: var(--radius); background: var(--surface-2); font-size: 72px; }
.product-card-body { padding: 14px; }
.product-category { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.product-card-body h3 { font-size: 15px; margin: 6px 0 4px; }
.product-seller { font-size: 13px; color: var(--text-muted); margin: 0 0 8px; }
.product-price { font-weight: 700; margin: 0; }
.product-price.large { font-size: 28px; margin: 12px 0; }
.empty-state { color: var(--text-muted); padding: 40px 0; }

.product-page { padding: 40px 0 80px; }
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.product-detail-media img { width: 100%; border-radius: var(--radius); }
.product-description { margin-top: 24px; }
.product-description h2 { font-size: 16px; }

.stacked-form { display: flex; flex-direction: column; gap: 16px; margin: 24px 0; }
.stacked-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-muted); }
.stacked-form input, .stacked-form textarea, .stacked-form select {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.checkbox-label input { width: auto; }
.form-error { background: rgba(239,68,68,0.1); border: 1px solid var(--danger); color: #fca5a5; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; }
.form-footnote { font-size: 14px; color: var(--text-muted); }

.cart-table { width: 100%; border-collapse: collapse; margin: 24px 0; }
.cart-table td, .cart-table th { padding: 12px 8px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.cart-total { font-size: 18px; font-weight: 700; margin: 20px 0; }
.pending-badge { color: var(--text-muted); font-size: 13px; }

.page-header-row { display: flex; justify-content: space-between; align-items: center; margin: 32px 0 16px; }

main h1 { margin-top: 32px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 700px) {
  .product-detail { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; gap: 12px; align-items: flex-start; }
}
