:root {
  --bg: #fff;
  --fg: #1a1a1a;
  --muted: #666;
  --line: #e5e5e5;
  --accent: #2563eb;
  --accent-fg: #fff;
  --danger: #b91c1c;
  --radius: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg); background: var(--bg);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; }
.cart-button {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; cursor: pointer;
}
.cart-count {
  background: var(--accent); color: var(--accent-fg);
  border-radius: 999px; font-size: 12px; padding: 2px 8px; min-width: 24px; text-align: center;
}
main { padding: 20px; max-width: 1100px; margin: 0 auto; }
.products {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f4f4f4; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-name { font-weight: 600; font-size: 15px; margin: 0; }
.card-price { color: var(--muted); font-size: 14px; }
.card button, .primary {
  background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: var(--radius); padding: 8px 12px;
  font-size: 14px; cursor: pointer; margin-top: auto;
}
.card button[disabled] { background: #aaa; cursor: not-allowed; }
.link-button { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0 0 12px; font-size: 14px; }
#product-detail { display: grid; gap: 20px; grid-template-columns: minmax(200px, 1fr) 2fr; }
#product-detail img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--radius); }
#product-detail h2 { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.variation-pickers { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 8px; }
.variation-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.variation-field select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--fg);
}
.cart-line {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center;
}
.cart-line img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; background: #f4f4f4; }
.cart-line .qty { display: flex; align-items: center; gap: 6px; }
.cart-line .qty button { width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 4px; cursor: pointer; }
.cart-line .remove { color: var(--danger); background: none; border: 0; cursor: pointer; font-size: 13px; }
.cart-totals { padding: 16px 0; font-size: 16px; display: flex; justify-content: space-between; border-top: 2px solid var(--fg); margin-top: 12px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.error { padding: 12px 16px; background: #fee2e2; color: var(--danger); border-radius: var(--radius); margin-bottom: 16px; }
@media (max-width: 600px) {
  #product-detail { grid-template-columns: 1fr; }
}
