:root {
  --brand: #1f5fa9;
  --brand-dark: #17497f;
  --brand-light: #eaf2fb;
  --ok: #16794a;
  --ok-bg: #e6f5ec;
  --warn: #a86b00;
  --warn-bg: #fdf3e0;
  --danger: #b8302c;
  --danger-bg: #fceceb;
  --text: #1b1f24;
  --text-2: #5b6472;
  --text-3: #8b95a3;
  --line: #e3e7ed;
  --bg: #f4f6f9;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

[v-cloak] { display: none !important; }

input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: linear-gradient(160deg, #1f5fa9 0%, #16324f 100%);
}
.login-card {
  width: 100%; max-width: 380px; background: #fff;
  border-radius: 18px; padding: 32px 26px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: .5px; }
.login-card .sub { color: var(--text-3); font-size: 13px; margin-bottom: 26px; }

/* ---------- 布局 ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); color: #fff;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px;
}
.app-header h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.app-header .store-pick {
  background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px; padding: 5px 8px; font-size: 13px; max-width: 150px;
}
.app-header .store-pick option { color: var(--text); }

main {
  padding: 14px 14px calc(76px + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; padding: 8px 0 7px; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 500;
}
.tabbar button .ic { font-size: 19px; line-height: 1; }
.tabbar button.on { color: var(--brand); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); padding: 14px; margin-bottom: 12px;
}
.card-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between;
}
.card-title .extra { font-weight: 400; color: var(--text-3); font-size: 12px; }

/* ---------- 指标 ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 13px;
}
.stat .k { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.stat .v { font-size: 21px; font-weight: 600; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.stat .d { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.stat.hl { background: var(--brand-light); border-color: #cfe0f5; }
.stat.hl .v { color: var(--brand-dark); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px;
}
.field > label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.45; }

.input, .select, .textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: #fafbfc; outline: none;
  transition: border-color .15s, background .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); background: #fff; }
.textarea { resize: vertical; min-height: 64px; }
.input[readonly] { color: var(--text-2); background: #f1f3f6; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.input-group { display: flex; }
.input-group .input { border-radius: 9px 0 0 9px; }
.input-group .select { width: 74px; border-radius: 0 9px 9px 0; border-left: none; background: #f1f3f6; }

/* 分段选择 */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fafbfc; font-size: 13.5px; color: var(--text-2); transition: all .12s;
}
.seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; border-radius: 10px; font-size: 15px; font-weight: 500;
  background: var(--brand); color: #fff; transition: opacity .12s;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .45; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.gray { background: #eef1f5; color: var(--text-2); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; gap: 11px; align-items: flex-start;
}
.item.pick { cursor: pointer; }
.item.sel { border-color: var(--brand); background: var(--brand-light); }
.item .thumb {
  width: 46px; height: 46px; border-radius: 8px; object-fit: cover;
  background: #eef1f5; flex-shrink: 0;
}
.item .thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 16px; }
.item .body { flex: 1; min-width: 0; }
.item .l1 { display: flex; align-items: baseline; gap: 7px; margin-bottom: 3px; }
.item .nm { font-weight: 600; font-size: 14.5px; }
.item .cd { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.item .l2 { font-size: 12.5px; color: var(--text-2); display: flex; gap: 10px; flex-wrap: wrap; }
.item .l3 { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.item .amt { text-align: right; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tag {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 11px;
  font-weight: 500; background: #eef1f5; color: var(--text-2); line-height: 1.6;
}
.tag.b { background: var(--brand-light); color: var(--brand-dark); }
.tag.g { background: var(--ok-bg); color: var(--ok); }
.tag.w { background: var(--warn-bg); color: var(--warn); }
.tag.r { background: var(--danger-bg); color: var(--danger); }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px;
  border-radius: 6px; font-size: 12.5px; background: #eef1f5; color: var(--text-2);
  line-height: 1.5; max-width: 100%;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip b {
  cursor: pointer; font-weight: 400; color: var(--text-3);
  padding: 0 2px; font-size: 14px; line-height: 1;
}
.chip b:hover { color: var(--danger); }

/* ---------- 入库物品清单（一单多品） ---------- */
.li {
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px;
  background: var(--card); overflow: hidden;
}
.li.open { border-color: #cfe0f5; }
.li-hd {
  display: flex; align-items: center; gap: 8px; padding: 11px 12px;
  background: #f7f9fc; cursor: pointer; font-size: 13px;
}
.li.open .li-hd { background: var(--brand-light); }
.li-no {
  flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--brand);
  color: #fff; font-size: 11.5px; font-weight: 600; display: flex;
  align-items: center; justify-content: center;
}
.li-sm {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-2);
}
.li.open .li-sm { color: var(--text); font-weight: 500; }
.li-x {
  flex: none; cursor: pointer; font-weight: 400; color: var(--text-3);
  font-size: 17px; line-height: 1; padding: 2px 4px;
}
.li-x:hover { color: var(--danger); }
.li-bd { padding: 14px 12px 4px; border-top: 1px solid var(--line); }
.li:not(.open) .li-bd { display: none; }

.empty { text-align: center; color: var(--text-3); padding: 40px 16px; font-size: 13.5px; }
.empty .ic { font-size: 34px; display: block; margin-bottom: 8px; opacity: .5; }

/* ---------- 搜索栏 ---------- */
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar .input { flex: 1; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h3 { margin: 0; font-size: 16.5px; font-weight: 600; }
.sheet-head .x { font-size: 22px; color: var(--text-3); padding: 0 4px; line-height: 1; }

/* ---------- 其它 ---------- */
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photo {
  width: 76px; height: 76px; border-radius: 9px; border: 1px solid var(--line);
  position: relative; overflow: hidden; background: #fafbfc;
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .del {
  position: absolute; top: 2px; right: 2px; width: 19px; height: 19px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; line-height: 18px; text-align: center;
}
.photo.add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 11.5px; gap: 2px; border-style: dashed; cursor: pointer;
}
.photo.add .ic { font-size: 20px; }

.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 999;
  background: rgba(24, 30, 40, .9); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; max-width: 80vw; text-align: center;
}
.toast.err { background: rgba(160, 32, 32, .94); }

.alert {
  padding: 10px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 12px;
  display: flex; gap: 8px; align-items: flex-start;
}
.alert.w { background: var(--warn-bg); color: var(--warn); }
.alert.r { background: var(--danger-bg); color: var(--danger); }
.alert.b { background: var(--brand-light); color: var(--brand-dark); }

.divider { height: 1px; background: var(--line); margin: 14px 0; }

.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed #eef0f4; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-3); }
.kv .v { font-weight: 500; font-variant-numeric: tabular-nums; }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 14px 0 4px; font-size: 13px; color: var(--text-3); }

.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.center { text-align: center; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mb0 { margin-bottom: 0; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .tabbar { max-width: 720px; margin: 0 auto; border-radius: 12px 12px 0 0; }
}
