:root {
  --primary: #2f6bff;
  --primary-d: #1f4fd6;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1c2330;
  --sub: #8a93a6;
  --ok: #18a058;
  --warn: #f0a020;
  --err: #e5484d;
  --line: #eef1f7;
  --radius: 14px;
  --tab-h: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ---------- 登录 ---------- */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #2f6bff 0%, #5b8cff 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px; background: #fff; border-radius: 20px;
  padding: 32px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.18);
}
.brand { text-align: center; margin-bottom: 26px; }
.brand-logo {
  width: 68px; height: 68px; margin: 0 auto 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, #2f6bff, #5b8cff);
  color: #fff; font-size: 34px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(47, 107, 255, .28);
}
.brand h1 { font-size: 23px; margin: 0 0 6px; letter-spacing: .5px; }
.brand-sub { color: var(--sub); font-size: 13px; margin: 0; }
#loginForm {
  display: flex; flex-direction: column; gap: 14px;
  animation: fadeIn .25s ease;
}
.login-btn {
  width: 100%;
  height: 50px;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}
.btn-primary {
  height: 48px; border-radius: 12px; background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 600; transition: .15s;
}
.btn-primary:active { background: var(--primary-d); transform: scale(.99); }
.btn-primary.block { width: 100%; }
.btn-outline {
  height: 46px; border-radius: 12px; background: #fff; color: var(--err);
  border: 1px solid #ffd5d7; font-size: 15px; width: 100%;
}
.err { color: var(--err); font-size: 13px; min-height: 18px; text-align: center; }
.demo-tip { margin-top: 16px; text-align: center; color: var(--sub); font-size: 12px; }
.switch-line { margin-top: 16px; text-align: center; color: var(--sub); font-size: 13px; }
.link { color: var(--primary); cursor: pointer; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ---------- 微信登录 / 绑定 ---------- */
.btn-wechat {
  width: 100%; height: 50px; margin-top: 14px; border-radius: 13px;
  background: #07c160; color: #fff; font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 20px rgba(7, 193, 96, .25); transition: .15s;
}
.btn-wechat:active { background: #06ad56; transform: scale(.99); }
.btn-wechat.wechat-off { background: #999; box-shadow: none; cursor: not-allowed; opacity: .85; }
.btn-wechat.wechat-off:active { transform: none; }
.wx-ico { font-size: 18px; }
.wx-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(31,79,214,.05);
}
.wx-row-text { font-size: 14px; color: #4b5468; display: flex; align-items: center; gap: 6px; }
.wx-bind-btn {
  height: 36px; padding: 0 16px; border-radius: 10px; flex-shrink: 0;
  background: #eaf9f0; color: #07c160; border: 1px solid #b7ecd0;
  font-size: 14px; font-weight: 600;
}
.wx-bind-btn:active { background: #dcf3e6; }

/* ---------- 注册表单美化 ---------- */
#registerForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.form-title {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 4px;
}
.form-title-icon {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, #2f6bff, #5b8cff);
  color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .28);
}
.form-title-main { font-size: 18px; font-weight: 700; color: var(--text); }
.form-title-sub { font-size: 12px; color: var(--sub); margin-top: 2px; }

.input-group {
  position: relative;
  display: flex; align-items: center;
  background: #fafbff;
  border: 1px solid #e3e8f2;
  border-radius: 13px;
  transition: .15s;
}
.input-group:focus-within {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .10);
}
.input-icon {
  width: 44px; text-align: center;
  font-size: 17px; color: var(--sub);
  user-select: none;
}
.input-group input {
  flex: 1; height: 50px;
  border: none; background: transparent;
  padding: 0 14px 0 0;
  font-size: 15px; outline: none; color: var(--text);
}
.input-group input::placeholder { color: #aab2c2; }
.register-btn {
  width: 100%;
  height: 50px;
  margin-top: 4px;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, var(--primary), #5b8cff);
  box-shadow: 0 8px 20px rgba(47, 107, 255, .28);
}
.register-btn:active { transform: translateY(1px) scale(.99); box-shadow: 0 4px 12px rgba(47, 107, 255, .22); }

/* ---------- 主框架 ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.app-bar {
  height: 52px; display: flex; align-items: center; justify-content: center;
  background: #fff; font-weight: 600; font-size: 17px;
  border-bottom: 1px solid #eef1f7; padding-top: env(safe-area-inset-top);
}
.app-main { flex: 1; overflow-y: auto; padding: 16px 16px calc(var(--tab-h) + 20px); }
.page { animation: fade .2s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* 底部标签栏 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid #eef1f7; display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--sub); font-size: 11px;
}
.tab span { font-size: 20px; }
.tab.active { color: var(--primary); }

/* 首页 */
.welcome { background: linear-gradient(135deg, #2f6bff, #5b8cff); color: #fff; border-radius: var(--radius); padding: 20px; }
.welcome-name { font-size: 20px; font-weight: 700; }
.welcome-sub { font-size: 13px; opacity: .9; margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 16px 8px; text-align: center; box-shadow: 0 4px 14px rgba(31,79,214,.05); }
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--sub); margin-top: 4px; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.quick-btn { background: #fff; border-radius: var(--radius); padding: 14px 6px; font-size: 13px; color: var(--text); box-shadow: 0 4px 14px rgba(31,79,214,.05); }

/* 卡片列表 */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.item-card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 4px 14px rgba(31,79,214,.05); }
.item-row { display: flex; justify-content: space-between; align-items: center; }
.item-name { font-weight: 600; font-size: 15px; }
.item-qty { font-size: 18px; font-weight: 700; color: var(--primary); }
.item-meta { color: var(--sub); font-size: 12px; margin-top: 6px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.pending { background: #fff3e0; color: var(--warn); }
.badge.approved { background: #e6f4ff; color: var(--primary); }
.badge.shipped { background: #e7f7ee; color: var(--ok); }
.badge.rejected { background: #fdeaea; color: var(--err); }
.empty { text-align: center; color: var(--sub); padding: 50px 0; font-size: 14px; }

/* 我的 */
.me-card { background: #fff; border-radius: var(--radius); padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: 0 4px 14px rgba(31,79,214,.05); }
.me-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; }
.me-name { font-size: 17px; font-weight: 700; }
.me-phone { color: var(--sub); font-size: 13px; margin-top: 2px; }
.block { margin-top: 16px; }

/* 取货弹层 */
.sheet-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; z-index: 50; }
.sheet { width: 100%; background: #fff; border-radius: 18px 18px 0 0; max-height: 80vh; display: flex; flex-direction: column; animation: up .25s; }
@keyframes up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; font-weight: 600; font-size: 16px; border-bottom: 1px solid #f0f2f7; }
.sheet-close { background: none; font-size: 18px; color: var(--sub); }
.sheet-body { padding: 16px; overflow-y: auto; }
.sheet-body input { width: 100%; height: 46px; border: 1px solid #e3e8f2; border-radius: 10px; padding: 0 14px; font-size: 15px; margin-bottom: 12px; outline: none; }
.sheet-body input:focus { border-color: var(--primary); }
.sheet-foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f3f5fa; }
.pick-row .pr-name { flex: 1; }
.pick-row .pr-stock { font-size: 12px; color: var(--sub); }
.pick-row input { width: 64px; height: 38px; border: 1px solid #e3e8f2; border-radius: 10px; text-align: center; font-size: 16px; }

/* toast */
.toast { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); background: rgba(0,0,0,.82); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 100; max-width: 80%; text-align: center; }
