* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f2f2f2;
  --card: #ffffff;
  --line: #d9d9d9;
  --text: #111111;
  --muted: #737373;
  --primary: #111111;
  --primary-dark: #000000;
  --danger: #dc2626;
  --green: #374151;
  --amber: #6b7280;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
#app { max-width: 640px; margin: 0 auto; min-height: 100%; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* ---------- 布局 ---------- */
.page { padding-bottom: 76px; }
.page-head {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.page-head .title { font-size: 17px; font-weight: 600; }
.page-head .back { color: var(--primary); background: none; border: none; font-size: 15px; padding: 4px 8px; cursor: pointer; }
.content { padding: 16px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 10px 0 8px;
  color: var(--muted); text-decoration: none; font-size: 12px;
}
.bottom-nav a .ico { font-size: 20px; display: block; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--primary); font-weight: 600; }

/* ---------- 卡片与表单 ---------- */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card h3 { font-size: 15px; margin-bottom: 12px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.btn {
  display: block; width: 100%;
  padding: 12px;
  font-size: 16px; font-weight: 600;
  border: none; border-radius: 10px;
  background: var(--primary); color: #fff;
  cursor: pointer;
}
.btn:active { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.green { background: var(--green); }
.btn.red { background: var(--danger); }.btn.sm { width: auto; padding: 6px 12px; font-size: 13px; border-radius: 8px; display: inline-block; }
.btn:disabled { opacity: .5; }

/* ---------- 提示 ---------- */
.warn {
  background: #fef2f2; color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 10px; padding: 10px 12px;
  font-size: 14px; margin-bottom: 12px;
}
.info {
  background: #f5f5f5; color: #111111;
  border: 1px solid #d9d9d9;
  border-radius: 10px; padding: 10px 12px;
  font-size: 14px; margin-bottom: 12px;
}
.ok-msg {
  background: #f5f5f5; color: #111111;
  border: 1px solid #d9d9d9;
  border-radius: 10px; padding: 10px 12px;
  font-size: 14px; margin-bottom: 12px;
}
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(17,24,39,.92); color: #fff;
  padding: 10px 20px; border-radius: 999px; font-size: 14px;
  z-index: 99; max-width: 90%;
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 列表 ---------- */
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .name { font-size: 15px; font-weight: 500; }
.list-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.qty { font-weight: 600; font-size: 15px; }
.qty.neg { color: var(--danger); }
.qty.pos { color: var(--text); }
.neg-text { color: var(--danger); }
.green-text { color: var(--green); }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
td:last-child, th:last-child { text-align: right; }
.table-card { overflow-x: auto; padding: 8px 12px; }

/* ---------- 更多菜单 ---------- */
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.menu-item:active { background: #f9fafb; }
.menu-item .ico { font-size: 22px; width: 32px; text-align: center; }
.menu-item .t { font-size: 15px; }
.menu-item .d { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 流水标签（黑白灰阶） */
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-right: 6px; }
.tag.init { background: #e5e5e5; color: #171717; }
.tag.purchase { background: #e5e5e5; color: #171717; }
.tag.work { background: #171717; color: #ffffff; }
.tag.transfer_out { background: #d4d4d4; color: #171717; }
.tag.transfer_in { background: #d4d4d4; color: #171717; }
.tag.adjust { background: #e5e5e5; color: #171717; }
.tag.reversal { background: #f0f0f0; color: #525252; border: 1px solid #d9d9d9; }

.actions { display: flex; gap: 8px; margin-top: 12px; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
.big-num { font-size: 24px; font-weight: 700; }
