/* ============ 物料商城 · 样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f2f4f7; color: #222; font-size: 14px;
}
.hidden { display: none !important; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #1a73e8 0%, #0d47a1 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-box {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px;
  padding: 30px 26px; box-shadow: 0 12px 40px rgba(0,0,0,.22);
}
.login-logo {
  width: 64px; height: 64px; background: #1a73e8; color: #fff; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: bold; margin: 0 auto 12px;
}
.login-title { text-align: center; font-size: 20px; font-weight: bold; }
.login-sub { text-align: center; font-size: 12px; color: #888; margin: 6px 0 22px; }
.init-tip { text-align: center; font-size: 14px; font-weight: bold; margin-bottom: 14px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: #666; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; height: 42px; border: 1px solid #d8dde3; border-radius: 9px;
  padding: 0 12px; font-size: 14px; background: #fafbfc; outline: none;
}
.field textarea { height: 64px; padding: 8px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #1a73e8; background: #fff; }

.btn {
  width: 100%; height: 46px; border: none; border-radius: 10px;
  font-size: 15px; font-weight: bold; color: #fff; cursor: pointer; margin-top: 4px;
}
.btn:active { opacity: .85; }
.btn-primary { background: #1a73e8; }
.btn-primary:hover { background: #1565d8; }
.form-err { color: #d93025; font-size: 12px; min-height: 16px; margin-top: 6px; }
.switch-link { text-align: center; margin-top: 14px; font-size: 13px; color: #1a73e8; cursor: pointer; }

/* ---------- 主界面 ---------- */
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: 62px; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: #1a73e8; color: #fff;
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.topbar-title { font-size: 17px; font-weight: bold; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-user { font-size: 12px; background: rgba(255,255,255,.18); padding: 4px 10px; border-radius: 12px; }
.btn-logout {
  border: none; background: rgba(255,255,255,.22); color: #fff;
  font-size: 12px; padding: 5px 12px; border-radius: 10px; cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,.32); }

.page-container { padding: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.page-title { font-size: 16px; font-weight: bold; }
.role-tag { font-size: 11px; color: #888; font-weight: normal; margin-left: 6px; }

/* 按钮 */
.btn-small {
  border: none; border-radius: 8px; padding: 7px 13px; font-size: 13px; color: #fff; cursor: pointer; margin-left: 6px;
}
.btn-small:active { opacity: .85; }
.btn-small.primary { background: #1a73e8; }
.btn-small.green { background: #188038; }
.btn-small.blue { background: #1a73e8; }
.btn-small.red { background: #d93025; }
.btn-small.gray { background: #8a9099; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-row .btn-small { margin-left: 0; }

.action-btn {
  flex: 1; border: none; border-radius: 12px; padding: 12px 8px; font-size: 14px; font-weight: bold;
  color: #fff; cursor: pointer;
}
.action-btn:active { opacity: .85; }
.action-btn.primary { background: #1a73e8; }
.action-btn.green { background: #188038; }
.action-btn.blue { background: #5f6368; }
.home-actions { display: flex; gap: 8px; margin-bottom: 14px; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: 12px; padding: 12px 6px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.stat-n { font-size: 20px; font-weight: bold; color: #1a73e8; }
.stat-l { font-size: 11px; color: #666; margin-top: 3px; }

/* 卡片 */
.card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.05); margin-bottom: 12px; }
.card-title { font-size: 14px; font-weight: bold; margin-bottom: 8px; }
.meta-text { font-size: 12px; color: #777; line-height: 1.8; margin-bottom: 10px; }
.note-card {
  background: #eef4fe; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
  font-size: 12px; color: #34568b; line-height: 1.9;
}
.section-title { font-size: 14px; font-weight: bold; margin: 14px 0 10px; }

/* 列表 */
.listCard { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.05); margin-bottom: 10px; }
.listCard .h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.listCard .name { font-size: 15px; font-weight: bold; word-break: break-all; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 10px; color: #fff; white-space: nowrap; }
.badge.normal { background: #5f6368; }
.badge.codeplate { background: #1a73e8; }
.badge.instock { background: #188038; }
.badge.issued { background: #e8710a; }
.badge.void { background: #8a9099; }
.badge.in { background: #188038; }
.badge.issue { background: #e8710a; }
.badge.return { background: #5f6368; }
.badge.void2 { background: #8a9099; }
.listCard .meta { font-size: 12px; color: #888; line-height: 1.9; }
.listCard .meta b { color: #333; }
.actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.empty { text-align: center; color: #9aa0a6; padding: 34px 0; font-size: 13px; }

/* 搜索/筛选 */
.search-row, .filter-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input, .filter-row input {
  flex: 1; height: 40px; border: 1px solid #d8dde3; border-radius: 10px; padding: 0 12px; font-size: 14px; background: #fff; outline: none;
}
.filter-row select {
  height: 40px; border: 1px solid #d8dde3; border-radius: 10px; padding: 0 8px; font-size: 13px; background: #fff; outline: none;
}
.search-row .btn-small, .filter-row .btn-small { height: 40px; margin-left: 0; }

/* 追踪时间线 */
.trace-step { border-left: 2px solid #1a73e8; margin-left: 8px; padding: 0 0 14px 16px; position: relative; }
.trace-step:before {
  content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #1a73e8;
}
.trace-step .at { font-size: 14px; font-weight: bold; margin-bottom: 4px; }
.trace-step .ad { font-size: 12px; color: #666; line-height: 1.8; }
.info-line { font-size: 13px; color: #555; line-height: 2; margin-bottom: 12px; }
.info-line b { color: #222; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px; background: #fff; display: flex;
  border-top: 1px solid #e4e7ec; z-index: 20;
}
.tabbar .tab { flex: 1; text-align: center; padding: 8px 0 7px; font-size: 11px; color: #8a9099; cursor: pointer; }
.tabbar .tab.on { color: #1a73e8; font-weight: bold; }
.tabbar .tab .tab-ic { font-size: 19px; display: block; margin-bottom: 2px; }

/* 对话框 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: #fff; border-radius: 14px; width: 100%; max-width: 400px; padding: 20px; max-height: 84vh; overflow-y: auto; }
.dialog h3 { font-size: 16px; margin-bottom: 14px; }
.dialogBtns { display: flex; gap: 10px; margin-top: 16px; }
.dialogBtns .btn { flex: 1; height: 42px; font-size: 14px; margin: 0; }
.dialogBtns .btn-cancel { background: #eef2f7; color: #333; }

/* 扫码 */
.scan-box { position: relative; width: 100%; aspect-ratio: 1; background: #000; border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 15%; border: 2px solid #34d399; border-radius: 8px; pointer-events: none; }
.scan-tip { text-align: center; font-size: 13px; color: #666; margin-bottom: 10px; }

/* Toast */
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 22px; border-radius: 20px;
  font-size: 14px; z-index: 99; display: none; max-width: 82%; text-align: center;
}

@media (max-width: 380px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
