:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #5b6478;
  --line: #e2e6f0;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --price: #0f9d58;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

a { color: var(--accent); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.site-header h1 {
  margin: 0;
  font-size: 1.35rem;
}

.site-header p {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.site-header p a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.site-header p a:hover { text-decoration: underline; }

.source {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
}

.source:hover { border-color: var(--accent); }

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.family { margin-bottom: 2rem; }

.family h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

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

.product {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.04);
  display: flex;
  flex-direction: column;
}

.product img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: #fbfcff;
  padding: 0.5rem;
}

.product-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.product-body h3 {
  margin: 0;
  font-size: 0.95rem;
}

.price {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-weight: 700;
  color: var(--price);
}

.add {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.add input {
  width: 3.5rem;
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  flex: 1;
}

button.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.add button { flex: 1; }

.cart {
  position: sticky;
  top: 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.04);
}

.cart h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.cart-item {
  border-top: 1px solid var(--line);
  padding: 0.6rem 0;
}

.cart-item:first-child { border-top: none; }

.cart-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-item-row .title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.qty .count {
  min-width: 1.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.step {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  line-height: 1;
  border-radius: 6px;
}

.remove {
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  line-height: 1;
  border-radius: 6px;
  color: var(--muted);
}

.remove:hover {
  border-color: #dc2626;
  color: #dc2626;
}

.amount {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 2px solid var(--line);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  font-weight: 700;
}

.cart-total code {
  font-size: 1.05rem;
  color: var(--price);
}

.cart-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}
