:root {
  --bg: #f3f5f7;
  --card: #fff;
  --primary: #1f6feb;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #059669;
  --warn: #d97706;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #e8eef7 0%, var(--bg) 180px);
  color: var(--text);
  min-height: 100vh;
}
#app { max-width: 480px; margin: 0 auto; padding: 12px 12px 84px; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 16px; }
.brand { font-size: 18px; font-weight: 700; }
.btn-sm {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 6px 10px; font-size: 13px; cursor: pointer;
}
.card {
  background: var(--card); border-radius: 14px; padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); margin-bottom: 12px;
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #f8fafc; border-radius: 12px; padding: 12px; cursor: pointer; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 4px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 15px; margin-bottom: 12px; background: #fff;
}
.btn {
  width: 100%; border: 0; border-radius: 10px; padding: 12px 14px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .6; }
.btn + .btn { margin-top: 8px; }
.btn-secondary { background: #334155; }
.btn-ok { background: var(--ok); }
.btn-out { background: #dc2626; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.btn-row .btn { width: 100%; margin-top: 0; }
.mode-tabs { margin-bottom: 12px; }
.depot-fixed {
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  background: #f8fafc; font-weight: 700; margin-bottom: 12px;
}
.hint-soft { color: var(--muted); font-size: 12px; margin: -4px 0 12px; line-height: 1.4; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff;
  border-top: 1px solid var(--border); display: flex; max-width: 480px; margin: 0 auto; z-index: 10;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav a {
  flex: 1; padding: 8px 4px 10px; font-size: 11px; color: var(--muted);
  text-align: center; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.nav a.router-link-active { color: var(--primary); font-weight: 700; }
.nav-icon {
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
}
.nav-icon svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-text { line-height: 1.2; }
.nav a.router-link-active .nav-icon svg { stroke-width: 2.1; }
.item { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.item .code { font-weight: 700; word-break: break-all; }
.item .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #eef2ff; color: #3730a3; margin-left: 6px;
}
.badge.in { background: #ecfdf5; color: #065f46; }
.badge.out { background: #fef2f2; color: #991b1b; }
.badge.warn { background: #fff7ed; color: #9a3412; }
.toast {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%);
  background: rgba(17,24,39,.92); color: #fff; padding: 10px 14px;
  border-radius: 10px; font-size: 13px; z-index: 99; max-width: 90%;
}
.hint { color: var(--muted); font-size: 12px; margin: -4px 0 12px; }
.rec { font-size: 12px; color: var(--warn); margin: -6px 0 10px; }
.user-line { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button {
  flex: 1; border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 8px; font-size: 13px; cursor: pointer;
}
.tabs button.active { background: #e8f0fe; border-color: #93c5fd; color: var(--primary); font-weight: 600; }
.row-actions { display: flex; gap: 8px; margin-top: 10px; }
.row-actions select { margin-bottom: 0; flex: 1; }
.row-actions .btn { width: auto; flex: 1; padding: 8px; font-size: 13px; margin-top: 0; }
.loc-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}
.loc-field label { margin-bottom: 4px; }
.loc-field select { margin-bottom: 0; }
.loc-save { width: auto; min-width: 64px; padding: 10px 12px; margin-top: 0; }
@media (max-width: 380px) {
  .loc-row { grid-template-columns: 1fr; }
  .loc-save { width: 100%; }
}
.cam-box {
  position: relative;
  min-height: 200px;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}
.cam-box.on { min-height: 260px; }
.cam-tip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #94a3b8; font-size: 13px; text-align: center; padding: 16px; z-index: 1;
}
.cam-box.on .cam-tip { display: none; }
#h5-qr-reader { width: 100%; }
#h5-qr-reader video { width: 100% !important; border-radius: 12px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 0; }
