:root {
  --green: #6fbb3d;
  --green-dark: #4f8f29;
  --ink: #262626;
  --ink-soft: #5c5c5c;
  --bg-soft: #f6f7f5;
  --border: #e3e5e1;
  --danger: #d64545;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Inter", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #fff;
}
nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 24px;
  background: var(--ink);
  flex-wrap: wrap;
}
nav a { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-size: 14px; }
nav a:hover { background: rgba(255, 255, 255, 0.12); }
nav a.current { background: rgba(255, 255, 255, 0.18); }
nav .brand { font-weight: 700; margin-right: 16px; color: var(--green); }
nav .spacer { flex: 1; }
nav button { background: var(--bg-soft); color: var(--ink); }
main { max-width: 980px; margin: 0 auto; padding: 24px; }
main.wide { max-width: 1440px; }
h1 { font-size: 22px; }
table { width: 100%; border-collapse: collapse; margin: 16px 0; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
th { background: var(--bg-soft); }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; width: 100%; }
textarea { resize: vertical; }
label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
button, .btn {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:disabled { opacity: 0.55; cursor: default; }
button.secondary, .btn.secondary { background: var(--bg-soft); color: var(--ink); }
button.small, .btn.small { padding: 6px 10px; font-size: 13px; }
button.danger { background: var(--bg-soft); color: var(--danger); }
.msg-ok { color: var(--green-dark); font-weight: 600; }
.msg-error { color: var(--danger); font-weight: 600; }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-dark);
  margin-bottom: 4px;
}
.actions { display: flex; gap: 10px; margin-top: 12px; }
.hint { color: var(--ink-soft); font-size: 13px; }

.combobox { position: relative; }
.combobox input[readonly] { background: var(--bg-soft); cursor: default; }
.combobox-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
}
.combobox-suggestions[hidden] { display: none; }
.combobox-suggestion { padding: 8px 10px; cursor: pointer; font-size: 14px; }
.combobox-suggestion:not(:last-child) { border-bottom: 1px solid var(--border); }
.combobox-suggestion:hover, .combobox-suggestion.active { background: var(--bg-soft); }
.combobox-suggestion .sugg-name { font-weight: 600; }
.combobox-suggestion .sugg-meta { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.combobox-empty { padding: 10px; color: var(--ink-soft); font-size: 13px; }
.combobox-group-label {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-dark);
  background: var(--bg-soft);
}
button.secondary.active { background: var(--green); color: #fff; }

.badge {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 4px;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}
.badge-warn { background: rgba(214, 69, 69, 0.12); color: var(--danger); }

.item-list { display: flex; flex-direction: column; gap: 2px; }
.item-row {
  display: grid;
  grid-template-columns: 40px 2fr 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
}
.item-row:hover { background: var(--bg-soft); }
.item-row .item-sub { color: var(--ink-soft); font-size: 13px; }
.item-row .item-price { font-weight: 600; text-align: right; }
.item-row .item-thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; background: var(--bg-soft); }

.item-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.item-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-decoration: none;
  color: var(--ink);
}
.item-card:hover { border-color: var(--green); background: var(--bg-soft); }
.item-card .item-thumb { width: 100%; height: 100px; object-fit: contain; background: var(--bg-soft); border-radius: 6px; margin-bottom: 8px; }
.item-card .item-name { font-weight: 600; margin-bottom: 4px; }
.item-card .item-sub { color: var(--ink-soft); font-size: 12px; margin-bottom: 6px; }
.item-card .item-badges { margin-bottom: 6px; }
.item-card .item-price { font-weight: 600; }

/* Login is the one page rendered before the nav exists. */
body.login { background: var(--bg-soft); display: flex; align-items: center; justify-content: center; height: 100vh; }
body.login form { background: #fff; padding: 32px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); width: 280px; }
body.login h1 { font-size: 18px; margin: 0 0 12px; }
body.login button { width: 100%; }
body.login input { margin: 8px 0 16px; }

/* Hidden until the session check passes, so a signed-out flash never shows data. */
body[data-auth="pending"] main, body[data-auth="pending"] nav { visibility: hidden; }
