:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2430;
  --muted: #667085;
  --line: #e3e7ee;
  --primary: #1f6feb;
  --primary-ink: #ffffff;
  --secondary: #eef2f9;
  --green: #157347;
  --red: #b42318;
  --amber: #b54708;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 17px; -webkit-text-size-adjust: 100%;
}
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 16px; position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 18px; }

/* panels */
.panel {
  background: var(--card); margin: 12px; padding: 16px;
  border-radius: 14px; box-shadow: var(--shadow);
}
.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
.big-input {
  flex: 1; width: 100%; font-size: 20px; padding: 14px;
  border: 2px solid var(--line); border-radius: 12px; outline: none;
}
.big-input:focus { border-color: var(--primary); }

/* buttons */
.btn {
  border: none; border-radius: 12px; padding: 12px 16px; font-size: 16px;
  font-weight: 600; cursor: pointer; background: var(--secondary); color: var(--ink);
}
.btn-lg { padding: 16px 20px; font-size: 18px; }
.btn-sm { padding: 8px 12px; font-size: 14px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:disabled { background: #9dbef4; }
.btn-secondary { background: var(--secondary); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn:active { transform: translateY(1px); }

/* bin header */
.bin-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.bin-title { font-size: 20px; font-weight: 700; }

/* scan */
.scan-row { display: flex; gap: 8px; margin-bottom: 6px; }
.scan-msg { min-height: 22px; margin: 4px 2px 10px; font-size: 15px; }
.scan-msg.ok { color: var(--green); font-weight: 600; }
.scan-msg.warn { color: var(--amber); font-weight: 600; }

/* camera */
.cam-wrap { position: relative; margin-bottom: 12px; }
.cam-wrap video { width: 100%; border-radius: 12px; background: #000; max-height: 40vh; object-fit: cover; }
.cam-close { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.9); }

/* table */
.count-table { width: 100%; border-collapse: collapse; }
.count-table th, .count-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.count-table th { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.count-table .num { text-align: right; width: 44px; }
.count-table td.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.row-sku { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.row-title { color: var(--muted); font-size: 13px; }
.delta-pos { color: var(--green); }
.delta-neg { color: var(--red); }
.delta-zero { color: var(--muted); }
.row-uncounted td { background: #fffdf5; }
.row-new td { background: #f2f9f2; }
.qty-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 34px; height: 34px; font-size: 18px; font-weight: 700; }

/* commit bar */
.commit-bar { position: sticky; bottom: 0; background: var(--card); padding-top: 12px; margin-top: 10px; border-top: 1px solid var(--line); }
.commit-actions { display: flex; gap: 8px; margin-top: 8px; }
.commit-actions .btn-lg { flex: 1; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.modal-card { background: var(--card); border-radius: 16px; padding: 20px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 8px; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 30; }

/* login */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--card); padding: 28px; border-radius: 16px; box-shadow: var(--shadow); width: 100%; max-width: 360px; text-align: center; }
.login-card h1 { margin: 0 0 4px; }
.pin-input { width: 100%; font-size: 26px; text-align: center; letter-spacing: .3em; padding: 14px; border: 2px solid var(--line); border-radius: 12px; margin: 16px 0; }
.err { color: var(--red); min-height: 20px; font-weight: 600; }
