:root {
  --bg: #f5f5f3;
  --card-bg: #ffffff;
  --border: #ddd;
  --text: #1c1c1c;
  --muted: #777;
  --accent: #2563eb;
  --danger: #c0392b;
  --low-bg: #fde8e8;
  --low-text: #c0392b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  background: #1c1c1c;
  color: #fff;
  padding: 0.6rem 1rem;
  gap: 0.5rem;
}
.topbar nav, .topbar .user-info { display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap; }
.topbar a { color: #fff; text-decoration: none; font-size: 0.95rem; }
.topbar a:hover { text-decoration: underline; }
main { max-width: 960px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.card.narrow { max-width: 360px; margin: 2rem auto; }
label { display: block; margin-bottom: 0.8rem; font-size: 0.9rem; }
label.checkbox { display: flex; align-items: center; gap: 0.4rem; }
input[type=text], input[type=password], select, textarea {
  display: block; width: 100%; margin-top: 0.3rem; padding: 0.5rem;
  border: 1px solid var(--border); border-radius: 6px; font-size: 1rem;
}
textarea { min-height: 3rem; }
button, .button {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 0.55rem 1rem; font-size: 0.95rem; cursor: pointer; text-decoration: none; display: inline-block;
}
button:disabled { background: #aaa; cursor: not-allowed; }
.link-button { background: none; color: var(--danger); padding: 0; font-size: 0.85rem; text-decoration: underline; }
.error { color: var(--danger); font-weight: 600; }
.muted { color: var(--muted); }
.flashes { list-style: none; padding: 0; margin: 0 0 1rem; }
.flashes li { background: #e6f4ea; border: 1px solid #b7e0c3; padding: 0.5rem 0.8rem; border-radius: 6px; margin-bottom: 0.4rem; }
.stock-table { width: 100%; border-collapse: collapse; background: var(--card-bg); margin-bottom: 1rem; }
.stock-table th, .stock-table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.stock-table tr.low-stock { background: var(--low-bg); }
.low-stock-text { color: var(--low-text); }
.stock-table .actions { display: flex; gap: 0.7rem; white-space: nowrap; }
.stock-table .actions a { font-size: 0.85rem; }
.neg { color: var(--danger); }
.pos { color: #1a7f37; }
.build-summary { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; }
.build-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.9rem; display: flex; flex-direction: column; gap: 0.2rem; min-width: 160px; }
.build-card.build-zero { border-color: var(--low-text); background: var(--low-bg); }
.inline-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.6rem; }
.inline-form input, .inline-form select { width: auto; margin-top: 0; }
details summary { cursor: pointer; font-size: 0.85rem; color: var(--accent); }
.table-wrap { overflow-x: auto; }

@media (max-width: 600px) {
  .stock-table { font-size: 0.82rem; }
  main { padding: 0.6rem; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
