:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --surface: #ffffff;
  --border: #dfe3df;
  --text: #1f2a24;
  --muted: #5d6b63;
  --accent: #1e7a52;
  --accent-contrast: #ffffff;
  --danger: #b3321f;
  --warn-bg: #fdecea;
  --ok-bg: #eaf6ef;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header {
  padding: 20px 20px 0;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

header p {
  margin: 0 0 16px;
  color: var(--muted);
}

nav {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

nav button {
  appearance: none;
  background: none;
  border: none;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

nav button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main {
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

section.panel { display: none; }
section.panel.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th { color: var(--muted); font-weight: 600; }

tr.low-stock td { background: var(--warn-bg); }
tr.ok-stock td { background: var(--ok-bg); }

.table-wrap { overflow-x: auto; }

form {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

label {
  display: grid;
  gap: 4px;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

textarea { resize: vertical; min-height: 60px; }

button.primary {
  appearance: none;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  justify-self: start;
}

button.primary:disabled { opacity: 0.6; cursor: wait; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}
.filter-bar label { display: grid; gap: 4px; }

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

a.secondary, button.secondary {
  appearance: none;
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
a.secondary:hover, button.secondary:hover { border-color: var(--accent); color: var(--accent); }

.status-msg { font-size: 13px; margin-top: 4px; }
.status-msg.error { color: var(--danger); }
.status-msg.ok { color: var(--accent); }

.muted { color: var(--muted); }
