:root {
  color-scheme: light dark;
  --border: #d8d8dc;
  --muted: #6b6b70;
  --accent: #2f6fed;
  --error: #c02f3f;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0 1.5rem 2rem;
  max-width: 960px;
  margin-inline: auto;
  color: #1a1a1e;
  background: #fff;
}

header {
  padding: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

h1 { margin: 0; font-size: 1.5rem; }
.subtitle { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }

main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 700px) {
  main { grid-template-columns: 1fr; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.product-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.product-card .name { font-weight: 600; }
.product-card .price { color: var(--muted); }

.product-card button {
  margin-top: auto;
  padding: 0.5rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
}
.product-card button:hover { opacity: 0.9; }

#cart-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: sticky;
  top: 1rem;
}

#cart-items { list-style: none; padding: 0; margin: 0 0 0.5rem; }
#cart-items li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

#cart-total { font-weight: 600; margin: 0.5rem 0 1rem; }

#checkout-form { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
#checkout-form input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
#checkout-form button, #reset-cart {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
}
#reset-cart {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: 100%;
}

#status { margin-top: 0.75rem; font-size: 0.85rem; }
#status.ok { color: #1a7f37; }
#status.error { color: var(--error); }

footer {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
