:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e6e8ec;
  --text: #1f2330;
  --sub: #6b7280;
  --primary: #2563eb;
  --primary-soft: #eef3fe;
  --ok: #0f9d58;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .3px; }
.logo {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
}
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 7px 14px; border-radius: 8px;
  color: var(--sub); text-decoration: none; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: #f2f4f7; color: var(--text); }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 40px; }

/* ---------- 页头 ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.page-head .sub { margin: 0; color: var(--sub); font-size: 13px; }
.head-cards { display: flex; gap: 10px; }
.mini-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 16px; min-width: 92px; text-align: center;
}
.mini-card span { display: block; font-size: 18px; font-weight: 600; color: var(--primary); }
.mini-card label { font-size: 12px; color: var(--sub); }

/* ---------- 卡片 / 布局 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.count { color: var(--sub); font-weight: 400; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.field.big input { height: 52px; font-size: 18px; letter-spacing: .5px; }
.scan-row { display: flex; gap: 10px; }
.scan-row input { flex: 1; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row-2 { grid-template-columns: 1fr; } }

.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn {
  height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #f7f8fa; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #1d4ed8; }
.btn.ghost { color: var(--sub); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.tip { font-size: 13px; }
.tip.ok { color: var(--ok); }
.tip.warn { color: var(--warn); }
.tip.err { color: var(--err); }

/* ---------- 表格 ---------- */
.table-scroll { max-height: 460px; overflow: auto; border-radius: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { position: sticky; top: 0; background: #fafbfc; color: var(--sub); font-weight: 500; z-index: 1; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl td.op { text-align: right; }
.tbl tbody tr:hover { background: #fafbfc; }
.tbl .empty { text-align: center; color: var(--sub); padding: 26px 0; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; background: var(--primary-soft); color: var(--primary); }
.tag.出库 { background: #fef2f2; color: var(--err); }
.tag.盘点 { background: #fffbeb; color: var(--warn); }
.tag.其他 { background: #f2f4f7; color: var(--sub); }
.link-del { color: var(--err); cursor: pointer; text-decoration: none; font-size: 13px; }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { width: auto; min-width: 150px; }
.filter-bar #keyword { min-width: 240px; flex: 1; }
.filter-bar .sep { color: var(--sub); }

/* ---------- 统计页 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-card label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.stat-card strong { font-size: 22px; font-weight: 600; }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 10px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, #60a5fa, var(--primary)); border-radius: 6px 6px 0 0; min-height: 3px; }
.bar-val { font-size: 12px; color: var(--sub); }
.bar-day { font-size: 12px; color: var(--sub); }

/* ---------- 摄像头弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,18,28,.55);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; padding: 16px; width: 100%; max-width: 440px;
}
.cam-box { position: relative; border-radius: 10px; overflow: hidden; background: #000; aspect-ratio: 4/3; }
.cam-box video { width: 100%; height: 100%; object-fit: cover; }
.cam-frame {
  position: absolute; inset: 18% 12%;
  border: 2px solid rgba(255,255,255,.85); border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.18);
}
.cam-tip { margin: 10px 0 0; font-size: 13px; color: var(--sub); text-align: center; }

/* ---------- 其它 ---------- */
.foot { text-align: center; color: #9aa1ad; font-size: 12px; padding: 24px 0 32px; }

.notice {
  background: #fffbeb; border: 1px solid #fde68a; color: #8a5a00;
  border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
  line-height: 1.7;
}
.notice a { color: var(--primary); }
@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .wrap { padding: 16px 12px 32px; }
  .head-cards { width: 100%; }
  .mini-card { flex: 1; }
}
