/* ============================================================
   罗盘 · ERP 工作台 设计系统
   ============================================================ */

:root {
  --brand: #2f6bff;
  --brand-2: #7c5cff;
  --brand-soft: rgba(47, 107, 255, 0.1);

  --bg: #f3f5fa;
  --bg-grad-a: #eef2fb;
  --bg-grad-b: #f7f4fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eef1f7;

  --text: #0e1626;
  --text-2: #5a6579;
  --text-3: #8d98ab;

  --line: rgba(14, 22, 38, 0.08);
  --line-strong: rgba(14, 22, 38, 0.14);

  --shadow-sm: 0 1px 2px rgba(14, 22, 38, 0.04);
  --shadow-md: 0 2px 8px rgba(14, 22, 38, 0.05), 0 16px 36px -20px rgba(14, 22, 38, 0.22);
  --shadow-lg: 0 24px 60px -24px rgba(14, 22, 38, 0.35);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --amber: #e08a00;
  --amber-bg: rgba(224, 138, 0, 0.12);
  --blue: #2f6bff;
  --blue-bg: rgba(47, 107, 255, 0.12);
  --red: #e5484d;
  --red-bg: rgba(229, 72, 77, 0.12);
  --violet: #7c5cff;
  --violet-bg: rgba(124, 92, 255, 0.12);
  --green: #0f9d76;
  --green-bg: rgba(15, 157, 118, 0.12);
  --gray: #7b8798;
  --gray-bg: rgba(123, 135, 152, 0.12);
  --orange: #ef6c1a;
  --orange-bg: rgba(239, 108, 26, 0.12);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
  --brand: #5b8bff;
  --brand-2: #9b7cff;
  --brand-soft: rgba(91, 139, 255, 0.16);

  --bg: #080c15;
  --bg-grad-a: #0a1020;
  --bg-grad-b: #0d0b1a;
  --surface: #121a29;
  --surface-2: #17202f;
  --surface-3: #1d2839;

  --text: #eef2fa;
  --text-2: #9fadc4;
  --text-3: #6b7a91;

  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.35), 0 20px 40px -24px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.9);

  --amber: #f2a93b;
  --amber-bg: rgba(242, 169, 59, 0.16);
  --blue: #6d9bff;
  --blue-bg: rgba(109, 155, 255, 0.16);
  --red: #ff6b70;
  --red-bg: rgba(255, 107, 112, 0.16);
  --violet: #a18bff;
  --violet-bg: rgba(161, 139, 255, 0.16);
  --green: #3ecfa4;
  --green-bg: rgba(62, 207, 164, 0.16);
  --gray: #93a1b5;
  --gray-bg: rgba(147, 161, 181, 0.16);
  --orange: #ff8b45;
  --orange-bg: rgba(255, 139, 69, 0.16);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1000px 600px at 120% -10%, var(--bg-grad-b), transparent 60%),
    radial-gradient(900px 600px at -20% 0%, var(--bg-grad-a), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

button, input, select { font-family: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--brand-soft); }

/* ---------------- 通用 ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.muted { color: var(--text-3); font-size: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(47, 107, 255, 0.7);
}
.btn-ghost { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-ghost:disabled { opacity: 0.5; }

.btn-spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  display: none;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .btn-label { display: none; }
.btn.is-loading .btn-spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.text-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  padding: 4px 2px;
}
.text-btn.danger { color: var(--red); }

.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.err { background: var(--red-bg); color: var(--red); }

/* ---------------- 登录页 ---------------- */

.auth-body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 22px calc(32px + env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
}

.aurora { position: fixed; inset: 0; z-index: 0; overflow: hidden; filter: blur(60px); opacity: 0.9; }
.orb { position: absolute; border-radius: 50%; }
.orb-a {
  width: 420px; height: 420px; top: -160px; right: -120px;
  background: radial-gradient(circle at 30% 30%, rgba(47,107,255,.55), transparent 70%);
}
.orb-b {
  width: 380px; height: 380px; bottom: -140px; left: -120px;
  background: radial-gradient(circle at 60% 40%, rgba(124,92,255,.5), transparent 70%);
}
.orb-c {
  width: 280px; height: 280px; top: 42%; left: 55%;
  background: radial-gradient(circle at 50% 50%, rgba(15,157,118,.28), transparent 70%);
}
[data-theme="dark"] .aurora { opacity: 0.55; }

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  animation: rise 0.6s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; padding-left: 4px; }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: 1px; }
.brand p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); letter-spacing: 0.6px; }

.brand-mark {
  width: 56px; height: 56px;
  border-radius: 18px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
  box-shadow: 0 14px 30px -12px rgba(47, 107, 255, 0.8);
  flex: none;
}
.brand-mark svg { width: 40px; height: 40px; }
.brand-mark.sm { width: 38px; height: 38px; border-radius: 13px; }
.brand-mark.sm svg { width: 26px; height: 26px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 22px 20px 20px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.seg {
  display: flex;
  background: var(--surface-2);
  border-radius: 13px;
  padding: 4px;
  gap: 2px;
}
.seg-item {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  transition: all 0.22s var(--ease);
}
.seg-item.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.seg-lg { margin-bottom: 22px; }
.seg-sm { padding: 3px; }
.seg-sm button {
  height: 28px; padding: 0 12px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-3);
  transition: all 0.2s var(--ease);
}
.seg-sm button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.field { display: block; margin-bottom: 16px; position: relative; }
.field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.field input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 16px;
  transition: border 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.ghost-eye {
  position: absolute;
  right: 6px; bottom: 8px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  color: var(--text-3);
  border-radius: 10px;
}
.ghost-eye svg { width: 20px; height: 20px; }

.form-error {
  min-height: 18px;
  margin: 2px 2px 12px;
  font-size: 12.5px;
  color: var(--red);
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s;
}
.form-error.show { opacity: 1; transform: none; }

.auth-hint {
  margin: 16px 2px 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}

.auth-title { margin: 2px 2px 18px; }
.auth-title h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.auth-title p { margin-top: 4px; font-size: 12.5px; color: var(--text-3); }

/* 管理员二级密码：数字要大、字距要开，方便一眼确认 */
.pin-input {  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding-left: 0.5em;
}

.auth-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-3);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.status-dot.err { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }

/* ---------------- 应用框架 ---------------- */

.app-body { background: var(--bg); }

.app-frame {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
}

.app-head {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(14px + env(safe-area-inset-top)) 18px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.app-head.is-scrolled { border-bottom-color: var(--line); }

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.head-copy { min-width: 0; }
.head-eyebrow {
  margin: 0 0 1px;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.4px;
}
.head-title { margin: 0; font-size: 21px; letter-spacing: 0.4px; font-weight: 700; }

.head-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  transition: transform 0.2s var(--spring), background 0.2s, color 0.2s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
.ico-sun { display: none; }
[data-theme="dark"] .ico-sun { display: block; }
[data-theme="dark"] .ico-moon { display: none; }

.link-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  padding: 0 2px 10px;
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}
.link-strip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); flex: none; }
.link-strip .dot.ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); animation: pulse 2.4s infinite; }
.link-strip .dot.warn { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.link-strip .dot.err { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--green-bg); }
  50% { box-shadow: 0 0 0 5px transparent; }
}
.strip-sep { width: 1px; height: 10px; background: var(--line-strong); }
.strip-time { margin-left: auto; font-variant-numeric: tabular-nums; }

.app-main { padding: 4px 16px 0; }

.view { display: none; animation: viewIn 0.32s var(--ease) both; }
.view.is-active { display: block; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.bottom-space { height: calc(96px + env(safe-area-inset-bottom)); }

/* ---------------- 首页 ---------------- */

.hero {
  position: relative;
  margin-top: 6px;
  padding: 20px 20px 18px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #1d4ed8 0%, #2f6bff 46%, #7c5cff 100%);
  border: 0;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 18px 40px -20px rgba(47, 107, 255, 0.75);
}
.hero-glow {
  position: absolute;
  width: 240px; height: 240px;
  right: -70px; top: -110px;
  background: radial-gradient(circle, rgba(255,255,255,0.34), transparent 65%);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-label { font-size: 12.5px; color: rgba(255,255,255,0.78); letter-spacing: 0.4px; }
.delta {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums;
}
.delta.up { color: #b6ffd9; }
.delta.down { color: #ffd0d2; }
.hero-value {
  font-size: 46px;
  font-weight: 750;
  letter-spacing: -1.2px;
  line-height: 1.12;
  margin: 6px 0 12px;
  font-variant-numeric: tabular-nums;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.16);
}
.hero-meta-item { display: flex; flex-direction: column; gap: 4px; }
.hero-meta-item > span { font-size: 11px; color: rgba(255,255,255,0.7); }
.hero-meta-item > b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-divider { width: 1px; height: 28px; background: rgba(255,255,255,0.18); }
.mini-split { display: flex; gap: 6px; }
.mini-split em {
  font-style: normal;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.92);
  font-variant-numeric: tabular-nums;
}
.mini-split b { font-size: 11.5px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 2px 10px;
}
.section-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.3px; }
.section-head .muted { font-size: 11.5px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px 12px;
  overflow: hidden;
  transition: transform 0.18s var(--ease), box-shadow 0.2s;
}
.stat-card:active { transform: scale(0.975); }
.stat-card::after {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--tone, var(--gray));
  opacity: 0.9;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-name { font-size: 12px; color: var(--text-2); }
.stat-mark { width: 6px; height: 6px; border-radius: 50%; background: var(--tone); opacity: 0.9; }
.stat-value {
  font-size: 25px;
  font-weight: 730;
  letter-spacing: -0.6px;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.stat-card.alert { background: linear-gradient(180deg, var(--red-bg), transparent 80%); }
.stat-card.alert .stat-value { color: var(--red); }

.skeleton {
  min-height: 92px;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }

/* ---------------- 图表 ---------------- */

.chart-card { margin-top: 16px; padding: 16px 14px 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.chart-wrap { position: relative; margin: 2px -4px 0; }
#curveSvg { width: 100%; height: 190px; display: block; overflow: visible; }
.chart-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; padding: 0 4px;
  font-size: 12px; color: var(--text-2);
}
.chart-foot b { font-variant-numeric: tabular-nums; color: var(--text); }

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--surface);
  font-size: 11.5px;
  line-height: 1.5;
  padding: 7px 10px;
  border-radius: 10px;
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { font-size: 13px; }

/* ---------------- 热销 ---------------- */

.top-list { display: flex; flex-direction: column; gap: 8px; }
.top-item {
  display: grid;
  grid-template-columns: 26px 42px 1fr auto;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 9px 12px 9px 10px;
}
.top-rank {
  font-size: 12px; font-weight: 700; color: var(--text-3);
  font-variant-numeric: tabular-nums; text-align: center;
}
.top-item:nth-child(1) .top-rank { color: var(--amber); }
.top-thumb {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center;
  font-size: 19px;
  background: var(--thumb, var(--surface-3));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}
.top-copy { min-width: 0; }
.top-copy b {
  display: block; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-copy small { font-size: 11px; color: var(--text-3); }
.top-num { text-align: right; }
.top-num b { font-size: 14px; font-variant-numeric: tabular-nums; }
.top-num small { display: block; font-size: 10.5px; color: var(--text-3); }

/* ---------------- 店铺 ---------------- */

.store-list { display: flex; flex-direction: column; gap: 8px; }
.store-item {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
}
.store-avatar {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand);
  flex: none;
}
.store-copy { min-width: 0; flex: 1; }
.store-copy b { display: block; font-size: 13px; font-weight: 600; }
.store-copy small { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.store-copy em { font-style: normal; }
.store-copy em.slow { color: var(--amber); font-weight: 600; }
.store-time { text-align: right; flex: none; }
.store-time b { display: block; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.store-time small { font-size: 10px; color: var(--text-3); }
.store-time .slow { color: var(--amber); }
.store-item.is-error { border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }
.store-more {
  width: 100%; margin-top: 2px; height: 40px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px; font-weight: 600;
}
.store-more:active { background: var(--surface-2); }
.store-copy .chg { font-style: normal; font-weight: 600; }
/* 订单量按经营口径：跌红涨绿，与首页「vs 昨日」保持一致 */
.store-copy .chg.up { color: var(--green); }
.store-copy .chg.down { color: var(--red); }

/* ---------------- 打包工时 / 类目 ---------------- */

.pack-card { padding: 15px 16px; display: flex; flex-direction: column; gap: 10px; }
.pack-main { display: flex; align-items: center; gap: 14px; }
.pack-num { display: flex; align-items: baseline; gap: 4px; }
.pack-num b {
  font-size: 30px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pack-num small { font-size: 11px; color: var(--text-3); }
.pack-copy { min-width: 0; flex: 1; }
.pack-copy b { display: block; font-size: 13px; font-weight: 600; }
.pack-copy p { margin-top: 3px; font-size: 11px; color: var(--text-3); }
.pack-copy em { font-style: normal; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pack-tip {
  font-size: 11.5px; line-height: 1.5;
  color: var(--amber);
  background: var(--amber-bg);
  border-radius: var(--r-sm);
  padding: 7px 10px;
}
.pack-tip.calm { color: var(--text-3); background: var(--surface-3); }

.cat-list { display: flex; flex-direction: column; gap: 9px; }
.cat-item { display: flex; align-items: center; gap: 10px; }
.cat-name { width: 54px; flex: none; font-size: 12px; color: var(--text-2); }
.cat-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.cat-val { width: 44px; flex: none; text-align: right; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

.snap-preview {
  margin: 4px 0 8px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex; flex-direction: column; gap: 6px;
}
.snap-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.snap-row span { color: var(--text-3); }
.snap-row b { font-variant-numeric: tabular-nums; }
.snap-preview[hidden] { display: none; }

/* ---------------- 订单 ---------------- */

.search-bar {
  position: relative;
  display: flex; align-items: center;
  height: 46px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  margin-top: 4px;
}
.search-bar > svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.search-bar input {
  flex: 1;
  border: 0; background: none; outline: none;
  font-size: 15px;
  padding: 0 10px;
  min-width: 0;
}
.search-bar input::-webkit-search-cancel-button { display: none; }
.clear-btn { width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; background: var(--surface-3); color: var(--text-3); }
.clear-btn svg { width: 13px; height: 13px; }
.search-bar.has-value .clear-btn { display: grid; }

.chip-row {
  display: flex; gap: 7px;
  overflow-x: auto;
  padding: 12px 18px 2px 2px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row[hidden] { display: none; }
.chip-row-sm { padding: 8px 2px 2px; }
.chip-row-sub { padding-top: 8px; }
.chip {
  flex: none;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all 0.18s var(--ease);
}
.chip.is-active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.chip .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 5px; vertical-align: 2px; background: var(--tone, var(--gray)); }

.list-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 2px 8px;
  font-size: 12px; color: var(--text-3);
}

.order-list { display: flex; flex-direction: column; gap: 9px; }
.order-card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px;
  transition: transform 0.16s var(--ease);
}
.order-card:active { transform: scale(0.985); }
.order-thumb {
  width: 54px; height: 54px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 24px;
  background: var(--thumb, var(--surface-3));
  position: relative;
  overflow: hidden;
  flex: none;
}
/* 真实商品图：盖在 emoji 上，加载失败就自动露出 emoji */
.top-thumb, .detail-thumb { position: relative; overflow: hidden; }
.order-thumb img, .top-thumb img, .detail-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
  background: var(--surface-3);
}
.order-body { min-width: 0; }
.order-title {
  display: flex; align-items: flex-start; gap: 8px;
  justify-content: space-between;
}
.order-name {
  font-size: 13px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.order-price { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.order-sub { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.order-no { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.order-tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.tag {
  font-size: 10.5px; font-weight: 600;
  padding: 3px 7px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2);
}
.tag.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tag.tone-blue { background: var(--blue-bg); color: var(--blue); }
.tag.tone-red { background: var(--red-bg); color: var(--red); }
.tag.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tag.tone-green { background: var(--green-bg); color: var(--green); }
.tag.tone-gray { background: var(--gray-bg); color: var(--gray); }
.tag.tone-orange { background: var(--orange-bg); color: var(--orange); }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.empty .emoji { font-size: 34px; display: block; margin-bottom: 10px; opacity: 0.7; }

/* ---------------- 任务 ---------------- */

.relay-card { padding: 16px; }
.relay-head { display: flex; align-items: flex-start; justify-content: space-between; }
.relay-kicker { font-size: 11px; color: var(--text-3); letter-spacing: 0.5px; }
.relay-head h3 { margin: 3px 0 0; font-size: 17px; letter-spacing: 0.2px; }
.relay-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.relay-metrics div { display: flex; flex-direction: column; gap: 3px; }
.relay-metrics span { font-size: 10.5px; color: var(--text-3); }
.relay-metrics b { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }

.quick-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-top: 14px;
}
.quick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px;
  text-align: left;
  transition: transform 0.16s var(--ease), border-color 0.2s;
}
.quick:active { transform: scale(0.97); }
.quick-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  margin-bottom: 4px;
}
.quick-ico svg { width: 17px; height: 17px; }
.tone-blue { color: var(--blue); background: var(--blue-bg); }
.tone-violet { color: var(--violet); background: var(--violet-bg); }
.tone-green { color: var(--green); background: var(--green-bg); }
.tone-amber { color: var(--amber); background: var(--amber-bg); }
.quick b { font-size: 13px; font-weight: 650; }
.quick small { font-size: 11px; color: var(--text-3); }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
}
.task-ico {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
  flex: none;
}
.task-ico svg { width: 15px; height: 15px; }
.task-item.running .task-ico { background: var(--blue-bg); color: var(--blue); }
.task-item.success .task-ico { background: var(--green-bg); color: var(--green); }
.task-item.failed .task-ico { background: var(--red-bg); color: var(--red); }
.task-copy { flex: 1; min-width: 0; }
.task-copy b { display: block; font-size: 12.5px; font-weight: 600; }
.task-copy small { font-size: 11px; color: var(--text-3); }
.task-state { font-size: 11px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.task-state.running { color: var(--blue); }
.task-state.success { color: var(--green); }
.task-state.failed { color: var(--red); }

.switch-list { display: flex; flex-direction: column; gap: 8px; }
.switch-item {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 13px;
}
.switch-item b { font-size: 12.5px; font-weight: 600; flex: 1; }
.switch-item small { font-size: 11px; color: var(--text-3); }

.switch {
  width: 46px; height: 28px;
  border-radius: 999px;
  background: #dfe4ee;
  position: relative;
  transition: background 0.22s var(--ease);
  flex: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .switch { background: #2c3849; }
.switch i {
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.24s var(--spring);
}
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"] i { transform: translateX(18px); }

/* 店铺开关列表 */
.store-switch-list { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow: auto; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: 0; }
.switch-name { font-size: 13px; font-weight: 520; letter-spacing: -0.01em; }

/* 管理员看板：数据范围切换 */
.scope-bar {
  display: flex; flex-direction: column; gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 11px;
  margin-bottom: 12px;
}
.scope-bar[hidden] { display: none; }
.scope-seg { width: 100%; }
.scope-seg button { flex: 1; }
.scope-chips {
  display: flex; gap: 7px; overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}
.scope-chips::-webkit-scrollbar { display: none; }
.scope-tip { font-size: 11.5px; color: var(--text-3); }
.chip.is-off { opacity: 0.42; text-decoration: line-through; }

/* 运输中货件 */
.ship-card { padding: 4px 0; }.ship-list { display: flex; flex-direction: column; }
.ship-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
}
.ship-row:last-child { border-bottom: 0; }
.ship-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ship-no { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.ship-store { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ship-empty { padding: 14px 13px; font-size: 12.5px; }

/* 订单列表里的「运输中」行：只显示货件号，不放商品图 */
.order-card.is-ship { align-items: center; }
.ship-thumb {
  background: var(--violet-bg) !important;
  font-size: 20px;
  display: grid;
  place-items: center;
}

/* 新建学员后的凭据回显 */
.acc-created {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: var(--green-bg);
  border: 1px solid color-mix(in srgb, var(--green) 26%, var(--line));
  font-size: 12.5px;
  line-height: 1.7;
}
.acc-created[hidden] { display: none; }

.log-list { display: flex; flex-direction: column; gap: 0; padding-left: 4px; }
.log-item {
  position: relative;
  padding: 0 0 14px 22px;
  font-size: 12px;
  color: var(--text-2);
}
.log-item::before {
  content: "";
  position: absolute;
  left: 3px; top: 4px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  box-shadow: 0 0 0 3px var(--bg);
  z-index: 1;
}
.log-item::after {
  content: "";
  position: absolute;
  left: 6px; top: 12px; bottom: 2px;
  width: 1px;
  background: var(--line-strong);
}
.log-item:last-child::after { display: none; }
.log-item.success::before { background: var(--green); }
.log-item.warn::before { background: var(--amber); }
.log-item.error::before { background: var(--red); }
.log-item .log-time { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.log-item p { margin: 2px 0 0; line-height: 1.45; }

/* ---------------- 我的 ---------------- */

.profile-card { display: flex; align-items: center; gap: 12px; padding: 16px; margin-top: 6px; }
.avatar {
  width: 48px; height: 48px; border-radius: 15px;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 700;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  color: #fff;
  flex: none;
}
.profile-copy { flex: 1; min-width: 0; }
.profile-copy h3 { margin: 0; font-size: 16px; }
.profile-copy p { margin: 3px 0 0; font-size: 11.5px; color: var(--text-3); }

.machine-card { margin-top: 10px; padding: 15px; }
.machine-head { display: flex; align-items: center; gap: 11px; }
.machine-ico {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
  flex: none;
}
.machine-ico svg { width: 18px; height: 18px; }
.machine-head > div { flex: 1; min-width: 0; }
.machine-head b { font-size: 13px; }
.machine-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-3); }
.machine-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px; padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--text-3);
}
.machine-meta code { font-family: var(--mono); font-size: 11px; color: var(--text-2); letter-spacing: 0.5px; }
.machine-note { margin: 10px 0 0; font-size: 11px; line-height: 1.55; color: var(--text-3); }
.serial-edit { display: flex; gap: 8px; margin-top: 10px; }
.serial-edit .input { flex: 1; min-width: 0; height: 36px; }
.field-optional span { color: var(--text-3); }

.setting-list { overflow: hidden; padding: 0; }
.setting-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  background: none;
}
.setting-row:last-child { border-bottom: 0; }
.setting-row > div { flex: 1; min-width: 0; }
.setting-row b { display: block; font-size: 13px; font-weight: 600; }
.setting-row small { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }
.setting-row.as-btn:active { background: var(--surface-2); }
.chev { color: var(--text-3); font-size: 18px; line-height: 1; }

.select {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  padding: 0 8px;
  font-size: 12.5px;
  outline: none;
}
.num-input {
  width: 76px; height: 34px;
  text-align: right;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  padding: 0 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.select:focus, .num-input:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.version-line { text-align: center; font-size: 11px; color: var(--text-3); margin: 18px 0 0; }

/* ---------------- 底部导航 ---------------- */

.tab-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  z-index: 40;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 0;
  color: var(--text-3);
  transition: color 0.2s;
}
.tab svg { width: 21px; height: 21px; transition: transform 0.24s var(--spring); }
.tab span { font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; }
.tab.is-active { color: var(--brand); }
.tab.is-active svg { transform: translateY(-1px) scale(1.06); }

/* ---------------- 弹层 ---------------- */

.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(6, 10, 20, 0.42);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease);
  z-index: 50;
}
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%; bottom: 0;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  transition: transform 0.34s var(--ease);
  display: flex;
  flex-direction: column;
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-grab {
  width: 38px; height: 4px; border-radius: 99px;
  background: var(--line-strong);
  margin: 9px auto 2px;
  flex: none;
}
.sheet-body {
  padding: 12px 20px calc(22px + env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet-sm .sheet-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.sheet-title { margin: 2px 0 0; font-size: 17px; }
.sheet-sub { margin: 4px 0 16px; font-size: 12px; color: var(--text-3); }
.input {
  width: 100%; height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
}
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; height: 46px; font-size: 15px; }

.detail-hero {
  display: flex; gap: 13px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--line);
}
.detail-thumb {
  width: 68px; height: 68px; border-radius: 15px;
  display: grid; place-items: center; font-size: 30px;
  background: var(--thumb, var(--surface-3));
  flex: none;
}
.detail-hero h3 { margin: 0; font-size: 15px; line-height: 1.4; }
.detail-hero .sub { margin: 5px 0 0; font-size: 12px; color: var(--text-3); }
.detail-price { font-size: 20px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }

.detail-rows { padding: 6px 0; }
.detail-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--text-3); }
.detail-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-row code { font-family: var(--mono); font-size: 11.5px; }

.detail-actions { display: flex; gap: 9px; margin-top: 8px; }
.detail-actions .btn { flex: 1; height: 44px; font-size: 14px; }
.note-field { margin-top: 14px; }
.note-field label { font-size: 12px; color: var(--text-3); display: block; margin-bottom: 7px; }
.tag-picker { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.tag-picker button {
  padding: 6px 11px; border-radius: 8px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.tag-picker button.is-active { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

/* ---------------- Toast ---------------- */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(94px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 90;
  pointer-events: none;
  width: max-content;
  max-width: 88vw;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--text) 92%, transparent);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 12.5px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.28s var(--spring) both;
}
.toast.out { animation: toastOut 0.2s ease both; }
.toast .ico { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; background: var(--green); color: #fff; flex: none; }
.toast.err .ico { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* ---------------- 绑定门禁 ---------------- */

.bind-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: viewIn 0.3s var(--ease) both;
}
.bind-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 26px 22px 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.bind-ico {
  width: 58px; height: 58px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.bind-ico svg { width: 30px; height: 30px; }
.bind-card h2 { margin: 0 0 8px; font-size: 19px; }
.bind-card p { margin: 0; font-size: 12.5px; line-height: 1.65; color: var(--text-2); }
.bind-meta {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px 10px;
  margin: 18px 0;
  padding: 13px;
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
  font-size: 12px;
}
.bind-meta span { color: var(--text-3); }
.bind-meta b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.bind-meta code { font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px; }
.bind-later { margin-top: 9px; height: 44px; font-size: 14px; }

.dialog-sheet { animation: sheetUp 0.28s var(--ease) both; }
@keyframes sheetUp {
  from { transform: translate(-50%, 100%); }
  to { transform: translate(-50%, 0); }
}

/* ---------------- 大屏适配 ---------------- */

@media (min-width: 700px) {
  .app-frame {
    max-width: 480px;
    min-height: calc(100dvh - 48px);
    margin: 24px auto;
    border-radius: 32px;
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    background: var(--bg);
  }
  .tab-bar { max-width: 480px; bottom: 24px; border-radius: 0 0 32px 32px; }
  .app-head { border-radius: 32px 32px 0 0; }
  .auth-card { padding: 26px 24px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------- 角色 / 授权 ---------------- */

[hidden] { display: none !important; }

/* 邀请横幅（登录页） */
.invite-banner {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.invite-banner.ok { border-color: color-mix(in srgb, var(--green) 38%, var(--line)); }
.invite-banner.bad { border-color: color-mix(in srgb, var(--red) 38%, var(--line)); }
.invite-icon { font-size: 22px; line-height: 1; }
.invite-copy { min-width: 0; }
.invite-copy b { display: block; font-size: 13.5px; }
.invite-copy p { margin-top: 3px; font-size: 11.5px; color: var(--text-3); line-height: 1.45; }

/* 学员顶部授权范围提示 */
.scope-strip {
  margin: 2px 0 12px;
  padding: 10px 13px;
  border-radius: var(--r-md);
  background: var(--brand-soft, rgba(47, 107, 255, 0.08));
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.scope-strip b { color: var(--text); font-weight: 600; }
.scope-strip small { display: block; margin-top: 3px; font-size: 11px; color: var(--text-3); }
.scope-strip.empty {
  background: var(--amber-bg);
  border-color: color-mix(in srgb, var(--amber) 30%, var(--line));
}

/* ERP 未连接提示条 */
.erp-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 2px 0 12px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  background: var(--amber-bg);
  border: 1px solid color-mix(in srgb, var(--amber) 32%, var(--line));
}
.erp-banner-copy { flex: 1; min-width: 0; }
.erp-banner-copy b { display: block; font-size: 13px; color: var(--text); }
.erp-banner-copy small { display: block; margin-top: 3px; font-size: 11px; color: var(--text-3); line-height: 1.5; }
.erp-banner .btn { flex: none; }
#refreshBtn.is-busy { opacity: 0.6; pointer-events: none; }
#refreshBtn.is-busy svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 管理页 */
.card-pad { padding: 14px 15px; }
.admin-note { font-size: 12px; color: var(--text-3); line-height: 1.55; margin-bottom: 10px; }
.admin-note b { color: var(--text-2); }
.inline-field { display: flex; gap: 8px; align-items: center; }
.inline-field .input { flex: 1; min-width: 0; }
.inline-field + .inline-field { margin-top: 8px; }
.invite-stores { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 11px; }
.invite-result {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px dashed var(--line);
  text-align: center;
}
.qr-box {
  display: inline-block; padding: 10px;
  background: #fff; border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.qr-box svg { display: block; width: 168px; height: 168px; }
.qr-tip { font-size: 11.5px; color: var(--text-3); margin: 9px 0 10px; }
.qr-fallback { font-size: 12px; color: var(--red); padding: 18px 8px; }
.invite-result .inline-field { margin-bottom: 10px; }

.account-list, .invite-list { display: flex; flex-direction: column; gap: 10px; }
.acc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px;
}
.acc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.acc-who b { font-size: 14px; }
.acc-who small { display: block; margin-top: 2px; font-size: 11px; color: var(--text-3); }
.acc-stores { margin-top: 9px; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.acc-meta { margin-top: 7px; display: flex; gap: 10px; flex-wrap: wrap; }
.acc-dev { font-size: 11px; color: var(--text-3); }
.acc-dev.warn { color: var(--amber); }
.acc-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.acc-stores-editor {
  display: flex; flex-wrap: wrap; gap: 7px;
  margin-top: 11px; padding-top: 11px;
  border-top: 1px dashed var(--line);
}
.invite-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.invite-row-main { flex: 1; min-width: 0; }
.invite-row-main b { display: block; font-size: 12.5px; font-weight: 600; }
.invite-row-main small { display: block; margin-top: 2px; font-size: 11px; color: var(--text-3); }
