/* Captivate Inventory — per Templates CLAUDE.md: warm neutrals, charcoal,
   restrained blue, 6–8px radii, dividers over cards, moderate density. */
:root {
  --bg: #f6f4f0;
  --surface: #fdfcfa;
  --line: #e4e0d8;
  --line-strong: #cfc9bd;
  --ink: #26241f;
  --ink-soft: #6b665c;
  --blue: #2b5d9e;
  --blue-ink: #234c81;
  --green: #2f7d4f;
  --yellow: #a07817;
  --red: #b1362f;
  --radius: 7px;
  --nav-h: 58px;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }

.boot { padding: 48px 20px; color: var(--ink-soft); text-align: center; }

/* ---------- shell ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.wordmark { font-weight: 600; letter-spacing: .01em; }
.wordmark small { color: var(--ink-soft); font-weight: 500; margin-left: 6px; }
.userchip {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.view { padding: 16px; max-width: 720px; margin: 0 auto; }
@media (min-width: 900px) { .view { max-width: 860px; } }

/* bottom nav */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  display: flex; border-top: 1px solid var(--line);
  background: var(--surface); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; border: 0; background: none; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 8px;
}
.tabs button svg { width: 21px; height: 21px; }
.tabs button.on { color: var(--blue-ink); }
.tabs .badge {
  position: absolute; transform: translate(12px, -4px);
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: 10px; min-width: 15px; height: 15px; line-height: 15px; text-align: center; padding: 0 3px;
}

/* ---------- primitives ---------- */
h2 { font-size: 17px; font-weight: 600; margin: 4px 0 12px; }
.section { margin-bottom: 22px; }
.section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); margin-bottom: 8px;
}
.divided > * { border-bottom: 1px solid var(--line); }
.divided > *:last-child { border-bottom: 0; }

.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 2px; text-align: left; width: 100%; background: none; border-radius: 0;
}
button.row { border: 0; cursor: pointer; }
.row .main { min-width: 0; }
.row .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: right; flex-shrink: 0; }
.num { font-family: "IBM Plex Mono", monospace; font-weight: 500; }

.btn {
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: var(--radius); padding: 10px 16px; font-weight: 500; cursor: pointer;
  min-height: 44px;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.primary:disabled { opacity: .5; }
.btn.ghost { border-color: transparent; background: none; color: var(--blue-ink); }
.btn.ghost.light { color: #fff; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--red); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); padding: 10px 12px; min-height: 44px;
}
.input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar .input { flex: 1; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.seg button {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius);
  padding: 8px 13px; font-size: 13.5px; font-weight: 500; cursor: pointer; min-height: 40px;
}
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.qty { display: flex; align-items: stretch; gap: 8px; }
.qty .input { text-align: center; font-family: "IBM Plex Mono", monospace; font-size: 18px; flex: 1; }
.qty button {
  width: 52px; border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: var(--radius); font-size: 20px; cursor: pointer;
}

.status { font-size: 12.5px; font-weight: 600; }
.status.ok { color: var(--green); }
.status.low { color: var(--yellow); }
.status.out, .status.sent { color: var(--red); }
.status.neutral { color: var(--ink-soft); font-weight: 500; }

.pick { display: flex; align-items: center; justify-content: space-between; width: 100%;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius);
  padding: 10px 12px; min-height: 44px; cursor: pointer; text-align: left; }
.pick .ph { color: var(--ink-soft); }

.note-sm { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
.empty { color: var(--ink-soft); padding: 22px 0; text-align: center; font-size: 14px; }
.error-line { color: var(--red); font-size: 13.5px; margin: 8px 0; min-height: 18px; }

.binbtns { display: flex; gap: 6px; }
.binbtns button {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius);
  padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.binbtns button.on.ok { background: var(--green); border-color: var(--green); color: #fff; }
.binbtns button.on.low { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.binbtns button.on.out { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  max-width: 380px; margin: 0 auto; padding: 24px; }
.login h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.login .sub { color: var(--ink-soft); margin-bottom: 28px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.pinpad button { min-height: 56px; font-size: 20px; border: 1px solid var(--line-strong);
  background: var(--surface); border-radius: var(--radius); cursor: pointer; }
.pindots { display: flex; gap: 10px; justify-content: center; margin: 18px 0 4px; }
.pindots span { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.pindots span.f { background: var(--ink); border-color: var(--ink); }

/* ---------- sheet ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(38,36,31,.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  background: var(--surface); border-radius: 12px 12px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 85dvh; overflow-y: auto; max-width: 720px; margin: 0 auto;
}
.sheet h3 { font-size: 16px; margin-bottom: 12px; }

/* ---------- scanner ---------- */
#scanner { position: fixed; inset: 0; background: #000; z-index: 40; }
#scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%);
  width: min(78vw, 340px); height: 150px; border: 2px solid rgba(255,255,255,.9); border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.35);
}
.scan-bar {
  position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6));
}

#toast {
  position: fixed; bottom: calc(var(--nav-h) + 18px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); border-radius: var(--radius);
  padding: 10px 18px; font-size: 14px; font-weight: 500; z-index: 50; max-width: 90vw;
}
#toast.err { background: var(--red); color: #fff; }
