/* ============================================================
   报单系统 - Bento Grid（便当盒布局）
   浅色 zinc 色板 / 不规则网格 / rounded-2xl / 柔和阴影 + 悬停上浮微放大
   与便当盒一致：大卡片放主要内容，小卡片放次要信息，间隙统一
   ============================================================ */
:root {
  --bg: #f6f6f7;              /* 页面底色 zinc-50/100 */
  --card: #ffffff;            /* 卡片 */
  --panel: #fafafa;           /* 内嵌扁平面板（非卡片） */
  --text: #18181b;            /* 主要文字 zinc-900 */
  --text-2: #52525b;          /* 次要文字 zinc-600 */
  --muted: #a1a1aa;           /* 弱化文字 zinc-400 */
  --line: #ececef;            /* 卡片描边（zinc-100 略深） */
  --line-2: #e4e4e7;          /* 输入框描边 zinc-200 */

  --primary: #18181b;         /* 主按钮：bg-zinc-900 text-white */
  --primary-2: #27272a;
  --on-primary: #ffffff;
  --soft: #f4f4f5;            /* 次级底 zinc-100 */

  --focus: #3b82f6;           /* focus:border-blue-500 */
  --ring: rgba(59, 130, 246, .20);  /* focus:ring-blue-500/20 */

  --danger: #e11d48;
  --ok: #059669;

  /* 便当盒强调渐变（彩色卡片） */
  --grad-a: linear-gradient(135deg, #3b82f6, #06b6d4);   /* 蓝 → 青 */
  --grad-b: linear-gradient(135deg, #f97316, #ec4899);   /* 橙 → 粉 */
  --grad-c: linear-gradient(135deg, #22c55e, #06b6d4);   /* 绿 → 青 */

  --radius: 16px;             /* rounded-2xl */
  --radius-sm: 12px;          /* rounded-xl */
  --gap: 16px;                /* gap-4：全局统一间隙 */

  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .06);
  --shadow-md: 0 4px 14px -4px rgba(24, 24, 27, .10);
  --shadow-lg: 0 8px 30px rgba(24, 24, 27, .10);   /* hover 广阔的柔和阴影 */

  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);             /* ease-out，无弹跳 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* 极轻的暖光背景，让白色便当盒浮起来（不用玻璃态） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(59, 130, 246, .07), transparent 60%),
    radial-gradient(800px 400px at 98% -6%, rgba(6, 182, 212, .06), transparent 62%);
}
body > * { position: relative; z-index: 1; }

a { color: inherit; }

/* 焦点样式：蓝色平滑光环 */
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, label:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--focus);
}

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

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}
.brand {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-logo {
  height: 34px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
}
.brand-fallback { margin-right: 2px; }
.nav {
  display: flex;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 1px;
}
.nav::-webkit-scrollbar { display: none; }
.nav-link {
  display: inline-block;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  background: transparent;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.nav-link:hover { background: var(--soft); color: var(--text); }
.nav-link.active { background: var(--primary); color: var(--on-primary); }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}
.who {
  color: var(--muted);
  font-size: 14px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout {
  color: var(--text-2);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.logout:hover { background: var(--soft); color: var(--danger); }

/* 管理后台顶栏：zinc-900 深色，与用户端区分 */
.topbar.nav-admin { background: #18181b; border-bottom-color: #27272a; }
.topbar.nav-admin .brand { color: #fafafa; }
.topbar.nav-admin .nav-link { color: #a1a1aa; }
.topbar.nav-admin .nav-link:hover { background: #27272a; color: #fafafa; }
.topbar.nav-admin .nav-link.active { background: #fafafa; color: #18181b; }
.topbar.nav-admin .who { color: #71717a; }
.topbar.nav-admin .logout { color: #a1a1aa; }
.topbar.nav-admin .logout:hover { background: #27272a; color: #fca5a5; }
/* 角色交叉入口（用户区 → 管理后台） */
.nav-link.nav-cta {
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--line-2);
}
.nav-link.nav-cta:hover { background: #e4e4e7; color: var(--text); }
.scope-admin .topbar-inner { max-width: 1280px; }

/* ---------- 主体 ---------- */
.main {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: var(--text);
}
.tip {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

/* ---------- 便当盒网格（Bento Grid） ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  grid-auto-rows: minmax(92px, auto);
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
/* 悬停：平滑上浮 + 微放大 + 阴影由紧凑变宽广 */
.tile:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-2);
}
.tile:active { transform: translateY(-1px) scale(.99); }

.tile-num {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.tile-label { font-size: 14px; color: var(--text-2); }
.tile-sub { font-size: 12.5px; color: var(--muted); }

/* 大卡片：跨 2 列 2 行，承载主要信息（可带渐变底） */
.tile-lg { grid-column: span 2; grid-row: span 2; }
.tile-lg .tile-num { font-size: 46px; }
.tile-lg .tile-label { font-size: 15px; }
/* 中卡片：跨 2 列 */
.tile-md { grid-column: span 2; }

/* 彩色强调卡：白字，正文用半透明白保证对比度 */
.tile.tile-accent,
.tile-accent {
  color: #ffffff;
  border-color: transparent;
  background-image: var(--grad-a);
  box-shadow: 0 8px 24px -14px rgba(59, 130, 246, .65);
}
.tile-accent .tile-num,
.tile-accent .tile-label,
.tile-accent .tile-sub { color: #ffffff; }
.tile-accent .tile-sub,
.tile-accent .tile-label { opacity: .88; }
.tile-accent:hover { box-shadow: 0 16px 40px -14px rgba(59, 130, 246, .6); }
.tile-accent-2 { background-image: var(--grad-b); box-shadow: 0 8px 24px -14px rgba(236, 72, 153, .6); }
.tile-accent-3 { background-image: var(--grad-c); box-shadow: 0 8px 24px -14px rgba(34, 197, 94, .6); }

/* 卡片内图标：group-hover 独立响应（放大 + 换色） */
.tile-ico {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  background: var(--soft);
  transition: transform .2s var(--ease), background-color .2s var(--ease);
}
.tile:hover .tile-ico { transform: scale(1.1); }
.tile:not(.tile-accent):hover .tile-ico { background: #eef2ff; }
.tile-accent .tile-ico { background: rgba(255, 255, 255, .22); }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile-arrow { color: var(--muted); font-size: 18px; line-height: 1; transition: transform .2s var(--ease); }
.tile:hover .tile-arrow { transform: translateX(3px); }
.tile-accent .tile-arrow { color: rgba(255, 255, 255, .85); }

/* ---------- 提示条 ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-weight: 500;
  font-size: 15px;
  border: 1px solid transparent;
}
.alert-ok  { background: #ecfdf5; color: var(--ok); border-color: #a7f3d0; }
.alert-err { background: #fff1f2; color: var(--danger); border-color: #fecdd3; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 7px;
  color: var(--text);
}
.req { color: var(--danger); }
.input {
  width: 100%;
  border: 1px solid var(--line-2);
  outline: none;
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.input::placeholder { color: var(--muted); }
.input:focus {
  background: var(--card);
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--ring);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.input-file { padding: 10px; background: var(--panel); }
.input-file::file-selector-button {
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-right: 10px;
  font-family: inherit;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.input-file::file-selector-button:hover { background: var(--soft); border-color: #d4d4d8; }
.mono { font-family: var(--mono); }
.strong { font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 22px 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  outline: none;
  cursor: pointer;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease);
}
.btn:hover {
  background: var(--primary-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0) scale(.96); box-shadow: var(--shadow-sm); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-sm { font-size: 13px; padding: 6px 14px; border-radius: var(--radius-sm); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #be123c; }
.btn-ghost {
  background: var(--card);
  color: var(--text-2);
  border: 1px solid var(--line-2);
}
.btn-ghost:hover { background: var(--soft); color: var(--text); border-color: #d4d4d8; }
.btn-ghost:active { transform: translateY(0) scale(.96); }

/* ---------- 收款码上传 ---------- */
.upload-row {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
}
.upload-item { flex: 1 1 220px; }
.qr-preview {
  display: none;
  margin-top: 10px;
  width: 130px;
  height: 130px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line-2);
  padding: 6px;
}
.qr-preview.shown { display: block; }

/* ---------- 报单实时预览（扁平内嵌面板，不做嵌套卡片） ---------- */
.preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 15px;
  box-shadow: none;
}
.preview-title { font-size: 15px; margin-bottom: 6px; color: var(--text); }
.preview-title b { font-family: var(--mono); }
.warn-text { color: var(--danger); }
.preview-list { list-style: none; max-height: 220px; overflow-y: auto; }
.preview-list li {
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
}
.preview-list li:last-child { border-bottom: none; }
.preview-bad { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* 报单实时预览：型号数量小标签 */
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pv-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12.5px;
  color: var(--text-2);
}
.pv-chip i {
  font-style: normal;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}

/* 报单格式说明行 */
.tip-line {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.7;
}
.tip-line code {
  font-family: var(--mono);
  background: var(--soft);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--text-2);
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  min-width: 640px;
}
.table th, .table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
  background: var(--panel);
  white-space: nowrap;
}
.table th:first-child { border-top-left-radius: var(--radius-sm); }
.table th:last-child  { border-top-right-radius: var(--radius-sm); }
.table tbody tr { transition: background-color .2s var(--ease); }
.table tbody tr:hover { background: var(--panel); }
.table tbody tr:last-child td { border-bottom: none; }
.table td form { margin: 0; }
.table .mono { font-variant-numeric: tabular-nums; }

/* ---------- 富文本编辑器 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.tb-btn {
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: transform .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.tb-btn:hover { background: var(--soft); color: var(--text); transform: translateY(-1px); }
.tb-btn:active { transform: translateY(0) scale(.96); }
.tb-italic { font-style: italic; }
.tb-underline { text-decoration: underline; }
.tb-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.tb-primary:hover { background: var(--primary-2); color: var(--on-primary); }
.tb-sep { width: 1px; background: var(--line-2); margin: 2px 4px; }
.editor {
  min-height: 320px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 16px;
  line-height: 1.8;
  background: var(--panel);
  outline: none;
  margin-bottom: 16px;
  word-break: break-word;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.editor:focus { background: var(--card); border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); }
.editor h2, .editor h3 { margin: 14px 0 8px; font-weight: 600; }
.editor ul, .editor ol { padding-left: 26px; margin: 8px 0; }
.rich-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 60px;
  line-height: 1.8;
  word-break: break-word;
  background: var(--panel);
  color: var(--text-2);
  box-shadow: none;
}
.rich-preview img, .editor img {
  max-width: min(100%, 340px) !important;
  width: auto;
  height: auto !important;
  display: block;
  margin: 8px auto;
  border-radius: var(--radius-sm);
}
.rich-preview:empty::before { content: "（编辑内容后此处实时预览）"; color: var(--muted); }

/* ---------- 登录 / 注册页 ---------- */
.auth-body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  background:
    radial-gradient(760px 380px at 50% -8%, rgba(59, 130, 246, .10), transparent 62%),
    var(--bg);
}
.auth-wrap { width: 100%; max-width: 460px; }
.auth-wrap-wide { max-width: 600px; }
.auth-title {
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
  color: var(--text);
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 18px;
}
.auth-brand-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 52px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 24px;
  background-image: var(--grad-a);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(59, 130, 246, .8);
  overflow: hidden;
  transition: transform .2s var(--ease);
}
.auth-brand:hover .auth-brand-ico { transform: scale(1.06); }
.auth-logo { display: block; height: 32px; width: auto; max-width: 180px; object-fit: contain; }
.auth-card { padding: 24px; }
/* 选项卡（登录 / 注册切换） */
.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--soft);
  border-radius: var(--radius-sm);
  padding: 5px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: background-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
a.auth-tab:hover { color: var(--text); background: rgba(255, 255, 255, .7); }
.auth-tab.active {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
/* 分组小标题 */
.auth-section {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  margin: 4px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.auth-section + .auth-section,
.field + .auth-section,
.field-grid + .auth-section { margin-top: 20px; }
/* 双列字段栅格 */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field-span { grid-column: 1 / -1; }
.auth-submit { padding: 13px 0; font-size: 16px; margin-top: 6px; }
.auth-foot { text-align: center; margin-top: 16px; color: var(--text-2); font-size: 14px; }
.auth-tip { text-align: center; margin-top: 18px; color: var(--muted); font-size: 13.5px; }
.auth-foot a { color: #2563eb; font-weight: 500; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* ---------- 管理后台：筛选 / 标签 / 批量栏 ---------- */
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-row .select { width: auto; min-width: 140px; flex: 0 0 auto; }
.filter-input { flex: 1 1 160px; width: auto; }
.filter-row .btn-sm { align-self: stretch; }
.role-tag {
  display: inline-block;
  background: var(--soft);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.qr-thumbs { display: flex; gap: 6px; align-items: center; }
.qr-thumbs img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line-2);
  display: block;
}
.table-users { min-width: 900px; }

/* ---------- 状态标签 / 选项卡 / 列表头 ---------- */
.status-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-pending  { background: #fffbeb; color: #b45309; }   /* 待入库 */
.status-instock  { background: #eff6ff; color: #1d4ed8; }   /* 已入库 */
.status-settling { background: var(--soft); color: var(--text-2); }  /* 待结算 */
.status-settled  { background: #ecfdf5; color: #047857; }   /* 已结算 */

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.list-head .card-title { margin-bottom: 0; }

.limit-switch, .range-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.limit-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.limit-btn:hover { background: var(--soft); color: var(--text); transform: translateY(-1px); }
.limit-btn.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.tab:hover { background: var(--soft); color: var(--text); transform: translateY(-1px); }
.tab.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.range-switch { margin-bottom: 14px; }

/* ---------- 我的（旧结构兜底） ---------- */
.profile-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.avatar-box { text-align: center; }
.avatar {
  width: 84px;
  height: 84px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--soft);
  border: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  color: var(--text-2);
}
.avatar-form { margin-top: 10px; }
.avatar-btn { display: inline-block; cursor: pointer; }
.profile-info { flex: 1 1 240px; }
.profile-row {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  align-items: baseline;
}
.profile-row:last-child { border-bottom: none; }
.profile-key { color: var(--text-2); flex: 0 0 60px; font-size: 14px; }
.kefu-box { text-align: center; padding: 10px 0 4px; }
.kefu-qr {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line-2);
  padding: 8px;
}
.price-text { color: #2563eb; }

/* ---------- 管理端表格小控件 ---------- */
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; }
.input-mini {
  width: auto;
  min-width: 70px;
  max-width: 130px;
  padding: 7px 10px;
  font-size: 14px;
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.input-mini:focus { background: var(--card); border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); outline: none; }
select.input-mini { min-width: 86px; }
.nowrap { white-space: nowrap; }

/* 后台宽屏：容器放宽 + 表格压缩 */
.scope-admin .main { max-width: 1280px; }
.scope-admin .table-orders-admin { min-width: 0; }
.scope-admin .table-orders-admin th,
.scope-admin .table-orders-admin td { padding: 8px; }
.scope-admin .table-orders-admin { font-size: 13.5px; }
.table-orders-admin .input-mini { min-width: 0; font-size: 13px; padding: 6px 8px; }
.table-orders-admin input[name="model"]  { width: 96px; }
.table-orders-admin input[name="quantity"] { width: 64px; }
.table-orders-admin select[name="status"] { width: 92px; min-width: 0; }
.table-orders-admin .btn-sm { padding: 5px 10px; font-size: 12.5px; }
.cell-date { font-size: 12.5px; }
.cell-remark { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 桌面端铺满容器：用 width:100% 而不是 min-width:0
   （min-width:0 权重比移动端那条 min-width:780px 高，会把窄屏的横向滚动压掉导致内容折行） */
.scope-admin .table-users { width: 100%; min-width: 0; }
.scope-admin .table-users th,
.scope-admin .table-users td { padding: 8px; }
/* 窄屏下账号/银行卡/角色/报单数等无空格内容会被 word-break 折成竖排，这些列必须 nowrap */
.scope-admin .table-users td.strong,
.scope-admin .table-users td.mono,
.scope-admin .table-users td.nowrap,
.scope-admin .table-users td .role-tag,
.scope-admin .table-users td.cell-count { white-space: nowrap; }
/* 桌面端也保持账号/银行卡整行不断（.table td 的 break-word 会折长数字串） */
.scope-admin .table-users td.strong,
.scope-admin .table-users td.mono { word-break: keep-all; }
/* 窄屏：让账号/银行卡列拿到足够宽度，长数字串才不会折行 */
@media (max-width: 720px) {
  .scope-admin .table-users th:nth-child(2),
  .scope-admin .table-users td:nth-child(2) { min-width: 116px; }
  .scope-admin .table-users th:nth-child(6),
  .scope-admin .table-users td:nth-child(6) { min-width: 168px; }
}

/* ---------- 查单对账：批量状态栏 + 收款信息 ---------- */
.batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 14px;
  box-shadow: none;
}
.batch-tip { font-size: 14px; color: var(--text-2); }
.batch-tip b { color: var(--text); font-family: var(--mono); }
.batch-bar .select { width: auto; min-width: 120px; }
.col-check { width: 36px; text-align: center; }
.col-check input, td.col-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.user-link { color: #2563eb; text-decoration: none; font-weight: 500; }
.user-link:hover { text-decoration: underline; }

.pay-card { background: var(--card); }
.pay-grid { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.pay-fields { flex: 1 1 260px; min-width: 240px; }
.pay-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.pay-row:last-child { border-bottom: none; }
.pay-k { color: var(--text-2); flex: 0 0 72px; }
.pay-qrs { flex: 0 0 auto; }
.qr-thumbs a { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; }
.qr-thumbs a img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line-2); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.qr-thumbs a:hover img { transform: translateY(-2px) scale(1.03); box-shadow: var(--shadow-md); }
.qr-thumbs a span { font-size: 12px; color: var(--text-2); }

/* ---------- 「我的」页：便当盒布局 ---------- */
.me-hero {
  display: flex; align-items: center; gap: 16px;
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.me-hero:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-lg); }
.me-avatar-wrap { position: relative; flex: 0 0 auto; }
.me-avatar {
  width: 68px; height: 68px; border-radius: 999px; object-fit: cover;
  border: 1px solid var(--line-2); box-shadow: var(--shadow-sm);
}
.me-avatar-default {
  display: flex; align-items: center; justify-content: center;
  background-image: var(--grad-a);
  color: #fff; font-size: 26px; font-weight: 600;
}
.me-avatar-form { position: absolute; right: -2px; bottom: -2px; margin: 0; }
.me-avatar-edit {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line-2); font-size: 12px;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.me-avatar-edit:hover { border-color: var(--focus); transform: scale(1.1); }
.me-hero-info { min-width: 0; }
.me-name { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.me-role { font-size: 13px; color: var(--text-2); margin-top: 3px; font-weight: 500; }
.me-phone { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* 状态区：便当盒网格 */
.me-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); grid-auto-rows: minmax(86px, auto); }
.me-pill {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px; color: var(--text-2); text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.me-pill b { font-family: var(--mono); font-size: 24px; font-weight: 600; color: var(--text); line-height: 1.1; }
.me-pill:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.me-pill:active { transform: translateY(-1px) scale(.99); }
/* 「全部」为大卡片：跨 2 列 2 行 + 渐变 */
.me-pill.me-pill-lg {
  grid-column: span 2; grid-row: span 2;
  justify-content: space-between;
  align-items: flex-start;
  background-image: var(--grad-a);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 8px 24px -14px rgba(59, 130, 246, .65);
}
.me-pill.me-pill-lg:hover { box-shadow: 0 16px 40px -14px rgba(59, 130, 246, .6); }
.me-pill.me-pill-lg b { font-size: 46px; color: #ffffff; }
.me-pill.me-pill-lg .tile-ico { background: rgba(255, 255, 255, .22); }
.me-pill.me-pill-lg .me-pill-body { color: rgba(255, 255, 255, .9); }
.me-pill-body { display: flex; flex-direction: column; gap: 2px; }
.me-pill-body b { font-family: var(--mono); font-size: 24px; font-weight: 600; color: var(--text); line-height: 1.1; }
.me-pill:hover .tile-ico { transform: scale(1.1); }
.me-pill.active { border-color: var(--text); box-shadow: var(--shadow-md); }
.me-pill.active:not(.me-pill-lg) { background: var(--soft); }
.me-pill.active:not(.me-pill-lg) span { color: var(--text); font-weight: 600; }

.me-menu { padding: 6px; }
.me-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-size: 15px;
  cursor: pointer; list-style: none;
  transition: background-color .2s var(--ease);
}
.me-item:hover { background: var(--panel); }
.me-item summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.me-item summary::-webkit-details-marker { display: none; }
.me-ico {
  font-size: 17px; width: 34px; height: 34px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--soft); border-radius: var(--radius-sm);
  transition: transform .2s var(--ease), background-color .2s var(--ease);
}
.me-item:hover .me-ico { transform: scale(1.1); background: #eef2ff; }
.me-label { flex: 1; font-weight: 500; }
.me-arrow { color: var(--muted); font-size: 18px; line-height: 1; transition: transform .2s var(--ease), color .2s var(--ease); }
.me-item[open] > summary .me-arrow { transform: rotate(90deg); }
.me-item[open] > summary .me-label { font-weight: 600; }

/* 展开区：扁平内嵌面板（避免卡片嵌套） */
.me-sub {
  margin: 10px 4px 8px 46px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: none;
  animation: meExpand .2s var(--ease);
  transform-origin: top;
}
@keyframes meExpand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.me-sub .field { margin-bottom: 12px; }
.me-sub .field .label { font-size: 13px; color: var(--text-2); margin-bottom: 5px; }
.me-sub .btn { margin-top: 6px; }
.me-sub .kefu-box { padding: 6px 0 2px; }
.me-qr-tip { margin: 0 0 12px; font-size: 13px; }
.me-sub .profile-row { padding: 7px 0; font-size: 14px; }

/* ---------- 后台：Logo 上传预览 ---------- */
.logo-preview-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.logo-preview-lg {
  height: 72px;
  min-width: 72px;
  max-width: 260px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 26px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.logo-preview-lg img { display: block; height: 52px; width: auto; max-width: 240px; object-fit: contain; }
.logo-preview-text { display: flex; flex-direction: column; gap: 2px; }
.logo-preview-text strong { font-size: 16px; color: var(--text); }
.logo-form { display: inline-block; vertical-align: top; }
.logo-clear { display: inline-block; margin-left: 8px; }

/* ---------- 滚动条 ---------- */
* { scrollbar-color: #d4d4d8 transparent; }

/* ---------- 移动端 / 平板适配 ---------- */
@media (max-width: 860px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento .tile-lg { grid-column: span 2; grid-row: span 1; }
  .bento .tile-md { grid-column: span 2; }
  .me-pills { grid-template-columns: repeat(2, 1fr); }
  .me-pill.me-pill-lg { grid-column: span 2; grid-row: span 1; }
  .me-pill.me-pill-lg b { font-size: 34px; }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .brand { font-size: 16.5px; flex: 1 1 auto; min-width: 0; }
  .brand-logo { height: 28px; max-width: 120px; }
  .nav { order: 3; flex: 1 1 100%; width: 100%; padding-bottom: 2px; }
  .topbar-right { order: 2; gap: 8px; }
  .nav-link { padding: 6px 12px; font-size: 14px; }
  .nav-cta { padding: 6px 12px; font-size: 14px; }
  .who { display: inline; font-size: 12.5px; max-width: 42vw; }
  .main { padding: 14px 12px 40px; gap: 14px; }
  .card { padding: 18px 14px; }
  .card-title { font-size: 17px; }
  .bento { gap: 12px; grid-auto-rows: minmax(78px, auto); }
  .tile { padding: 14px; }
  .tile-lg .tile-num { font-size: 36px; }
  .tile-num { font-size: 24px; }

  .auth-title { font-size: 20px; }
  .auth-body { padding: 26px 14px; }
  .auth-brand { font-size: 18px; margin-bottom: 14px; }
  .auth-brand-ico { min-width: 44px; height: 44px; border-radius: var(--radius-sm); }
  .auth-logo { height: 26px; max-width: 150px; }
  .auth-card { padding: 18px 15px; }
  .auth-tabs { margin-bottom: 16px; }
  .auth-tab { padding: 9px 0; font-size: 14.5px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .upload-row { flex-direction: column; }
  .upload-row .upload-item { flex: 0 0 auto; }

  /* 表格：压缩内边距，可横向滑动；窄表（3列）完整放下不滑动 */
  .table { min-width: 520px; font-size: 13.5px; }
  .table th, .table td { padding: 8px; }
  .table td { word-break: break-word; }
  .table-narrow { min-width: 0; }
  .preview-list li { word-break: break-all; }

  /* 后台在手机上恢复横向滑动，避免挤成一团
     注意：这些 min-width 必须 !important —— 桌面那条 `.scope-admin .table-users { min-width: 0 }`
     选择器权重更高（两个类），不加的话窄屏横向滑动会失效、内容全被折行 */
  .scope-admin .table-orders-admin { min-width: 760px !important; }
  .scope-admin .table-users { min-width: 780px !important; }
  .scope-admin .table-logs { min-width: 860px !important; }
  /* 可疑 IP 表（5 列）也要能横向滑动，否则 IP 会被挤成竖排字符 */
  .scope-admin .table-risk-ip { min-width: 620px; }
  .cell-remark { max-width: 120px; }
  .filter-row .select { min-width: 0; flex: 1 1 40%; }
  .filter-input { flex: 1 1 100%; }

  .me-hero { padding: 16px 14px; gap: 12px; }
  .me-avatar { width: 58px; height: 58px; }
  .me-pills { gap: 12px; }
  .me-pill { padding: 12px; }
  .me-pill b { font-size: 20px; }
  .me-pill.me-pill-lg b { font-size: 30px; }
  .me-sub { margin: 8px 0 8px 0; padding: 14px; }
}

/* ---------- 账号水印：用户界面平铺，截图外发可追溯到人 ---------- */
.wm {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 130px;
  align-items: center;
  justify-items: center;
  user-select: none;
  -webkit-user-select: none;
}
.wm span {
  transform: rotate(-22deg);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(24, 24, 27, .055);
  white-space: nowrap;
}

/* 顶栏账号旁的姓名 */
.who-name { font-style: normal; font-weight: 500; color: var(--text-2); margin-left: 6px; }
.who-name::before { content: "· "; }

/* 查单对账：报单人列的姓名小字 */
.user-name { display: block; font-style: normal; font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.3; }

/* ---------- 结算行情：最新价 + 可展开历史价格 ---------- */
.settle-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--danger);
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.settle-note::before { content: '※'; flex: none; font-weight: 700; }
@media (max-width: 640px) {
  .settle-note { font-size: 13.5px; padding: 9px 12px; }
}

.mh-list { display: flex; flex-direction: column; }
.mh-model { padding: 14px 2px; border-top: 1px solid var(--line); }
.mh-model:first-child { border-top: none; padding-top: 4px; }
.mh-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mh-name { font-size: 16px; font-weight: 600; color: var(--text); word-break: break-all; }
.mh-meta { display: flex; align-items: baseline; gap: 10px; flex: 0 0 auto; }
.mh-date { font-size: 13px; color: var(--muted); }
.mh-price { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text); }
.mh-price i { font-style: normal; font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.mh-hist { margin-top: 6px; }
.mh-hist summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color .2s var(--ease);
}
.mh-hist summary::-webkit-details-marker { display: none; }
.mh-hist summary::before { content: "\25B8"; font-size: 11px; transition: transform .2s var(--ease); }
.mh-hist[open] summary::before { transform: rotate(90deg); }
.mh-hist summary:hover { color: var(--text); }
.mh-hist ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px 12px;
  background: var(--panel);
  border-radius: var(--radius-sm);
}
.mh-hist li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 13px; color: var(--text-2); }
.mh-hist li + li { border-top: 1px dashed var(--line-2); }
.mh-h-date { flex: 0 0 auto; }
.mh-h-price { font-family: var(--mono); font-weight: 600; color: var(--text); }

/* ---------- 结算行情：迷你走势图（Sparkline） ---------- */
/* 说明：SVG 用 preserveAspectRatio="none" 横向铺满，
   所以线条宽度靠 vector-effect:non-scaling-stroke 锁定，不随容器宽度变形。
   末端圆点用绝对定位的 HTML 元素画 —— SVG 里的 <circle> 横向拉伸会变成椭圆。*/
.spark {
  margin-top: 10px;
  padding: 10px 12px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.spark-chart { position: relative; height: 56px; }
.spark-svg { display: block; width: 100%; height: 56px; overflow: visible; }
.spark-area { color: inherit; }
.spark-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.spark-base {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  opacity: .5;
  vector-effect: non-scaling-stroke;
}
.spark-mark { stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-dot {
  position: absolute;
  right: -4px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px var(--panel);
}
/* A股习惯：红涨绿跌 */
.spark-up { color: var(--danger); }
.spark-down { color: var(--ok); }
.spark-flat { color: var(--muted); }

.spark-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
}
.spark-trend { font-weight: 600; display: inline-flex; align-items: baseline; gap: 4px; min-width: 0; }
.spark-arrow { font-style: normal; font-size: 10px; }
.spark-trend em { font-style: normal; font-weight: 500; opacity: .75; font-family: var(--mono); }
.spark-range { color: var(--muted); font-family: var(--mono); flex: 0 0 auto; }
/* 持平态把文字从灰色提回次要灰，避免看不清 */
.spark-flat .spark-trend { color: var(--text-2); }
.spark-none { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

@media (max-width: 640px) {
  .spark { padding: 9px 10px 7px; }
  .spark-chart, .spark-svg { height: 48px; }
  .spark-foot { font-size: 11.5px; gap: 8px; }
  .spark-range { font-size: 11px; }
}

@media (max-width: 640px) {
  .wm { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 110px; }
  .wm span { font-size: 12px; }
}

/* ---------- 后台设置：卡片内小节标题与表单分隔 ---------- */
.sub-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.form-sep {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* ---------- 后台对账：型号分行编辑（每个型号一行，各自带数量） ---------- */
.model-form { min-width: 268px; }
.md-list { display: flex; flex-direction: column; gap: 6px; }
.md-row { display: flex; align-items: center; gap: 6px; }
.md-row input[name="models[]"] { flex: 1 1 auto; min-width: 108px; }
.md-row .md-qty { flex: 0 0 68px; text-align: center; }
.md-x { flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.md-del {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.md-del:hover { color: var(--danger); border-color: #fecdd3; background: #fff1f2; }
.md-add {
  align-self: flex-start;
  margin-top: 2px;
  padding: 4px 10px;
  border: 1px dashed var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.md-add:hover { background: var(--soft); color: var(--text); }

/* ---------- 后台对账：当日结算金额 ---------- */
.cell-amount { white-space: nowrap; }
.cell-amount .amt {
  display: block;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: help;
}
.cell-amount .amt-warn {
  display: block;
  font-size: 11.5px;
  color: var(--danger);
  line-height: 1.4;
  max-width: 130px;
  white-space: normal;
  word-break: break-all;
}
.tile-money { background-image: var(--grad-c); border-color: transparent; color: #fff; }
.tile-money .tile-num,
.tile-money .tile-label,
.tile-money .tile-sub { color: #fff; }
.tile-money .tile-num.money { font-family: var(--mono); }

/* ---------- 型号别名 / 关键词 ---------- */
.alias-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.alias-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 1px 4px 1px 9px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.alias-del-form { display: inline; }
.alias-x {
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 1px 5px;
  border-radius: 999px;
  color: var(--muted);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.alias-x:hover { background: var(--line); color: var(--danger); }
.amt-alias {
  display: block;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  max-width: 130px;
  white-space: normal;
  word-break: break-all;
  cursor: help;
}
.try-box {
  font-size: 13.5px;
  line-height: 1.7;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
}
.try-box b { font-weight: 700; }
.try-ok { border-color: rgba(22,163,74,.35); background: rgba(22,163,74,.07); color: var(--ok); }
.try-bad { border-color: rgba(220,38,38,.32); background: rgba(220,38,38,.06); color: var(--danger); }
@media (max-width: 640px) {
  .amt-alias, .cell-amount .amt-warn { max-width: 96px; }
}

/* ---------- 用户页公告：紧凑可折叠条（替代整张 card，节省首屏空间） ---------- */
.notice {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}
.notice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  cursor: pointer;
  list-style: none;
  min-height: 38px;
  transition: background-color .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.notice-bar::-webkit-details-marker { display: none; }
.notice-bar:hover { background: var(--soft); }
.notice-ico { font-size: 15px; line-height: 1; flex: none; }
.notice-sum {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notice-tog {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  padding: 1px 4px;
  transition: color .2s var(--ease);
}
.notice-tog::after { content: ' ▾'; }
.notice[open] .notice-tog::after { content: ' ▴'; }
.notice[open] .notice-bar { border-bottom: 1px solid var(--line); }
.notice[open] .notice-tog { color: var(--primary); }

/* 展开区：比管理端预览更紧凑，字号行高都收一档 */
.notice-body {
  border: 0;
  border-radius: 0;
  min-height: 0;
  padding: 12px 13px;
  font-size: 13.5px;
  line-height: 1.65;
  background: transparent;
  word-break: break-word;
}
.notice-body img {
  max-width: min(100%, 220px) !important;
  margin: 6px auto;
  border-radius: 8px;
}
.notice-body > :first-child { margin-top: 0; }
.notice-body > :last-child { margin-bottom: 0; }
.notice-body p, .notice-body div { margin: 0 0 6px; }
.notice-body h2 { font-size: 15px; margin: 10px 0 5px; }
.notice-body h3 { font-size: 14px; margin: 9px 0 4px; }
.notice-body ul, .notice-body ol { margin: 4px 0 6px; padding-left: 22px; }
.notice-foot {
  padding: 6px 13px 9px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
@media (max-width: 640px) {
  .notice-bar { padding: 9px 11px; gap: 7px; }
  .notice-sum { font-size: 13px; }
  .notice-body { padding: 11px; font-size: 13px; }
}

/* ---------- 收款码灯箱：点击缩略图就地放大，遮罩/×/Esc 关闭 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: rgba(9, 9, 11, .72);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  cursor: zoom-out;
}
.lightbox.show { display: flex; }
.lightbox-img {
  max-width: min(92vw, 520px);
  max-height: 76vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .35);
  cursor: zoom-out;
  animation: lbIn .2s var(--ease);
}
@keyframes lbIn {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}
.lightbox-cap {
  font-size: 13.5px;
  color: #fff;
  opacity: .92;
  text-align: center;
}
.lightbox-close {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 10001;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  cursor: pointer;
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.lightbox-close:hover { background: rgba(255, 255, 255, .26); transform: rotate(90deg); }
.lightbox-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .lightbox-img { animation: none; }
  .lightbox-close { transition: none; }
}
@media (max-width: 640px) {
  .lightbox { padding: 16px; }
  .lightbox-img { max-width: 92vw; max-height: 70vh; }
}

/* ---------- 查单对账：状态快捷标签（带条数，点一下即筛选） ---------- */
.st-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 14px;
}
.st-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  line-height: 1.6;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .2s var(--ease);
}
.st-tab b {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.st-tab:hover { border-color: var(--line-2); background: var(--soft); color: var(--text); transform: translateY(-1px); }
.st-tab.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--card);
}
.st-tab.active b { color: var(--card); opacity: .75; }
/* 状态色点：一眼分辨 */
.st-tab::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--line-2);
  flex: none;
}
.st-tab.st-pending::before { background: #94a3b8; }
.st-tab.st-instock::before  { background: #3b82f6; }
.st-tab.st-settling::before { background: #f59e0b; }
.st-tab.st-settled::before  { background: #16a34a; }
.st-tab.active::before { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
/* 安全日志页复用的两个状态点 */
.st-tab.st-fail::before    { background: #e11d48; }
@media (max-width: 640px) {
  .st-tabs { gap: 5px; margin: 10px 0 12px; }
  .st-tab { font-size: 12.5px; padding: 4px 9px; }
}

/* ---------- 安全日志 ---------- */
.table-logs { min-width: 880px; }
/* IP 数字段不能被打竖排：.table td 的 word-break:break-word 在窄屏会覆盖 nowrap */
.table-logs td.mono, .table-logs td.ev-tag, .table-logs td.res-tag { white-space: nowrap; }
.table-logs td.log-reason { white-space: normal; }
/* 失败行淡红底，一眼扫到异常 */
.table-logs tbody tr.row-fail { background: #fff7f8; }
.table-logs tbody tr.row-fail:hover { background: #ffeef1; }
.table-logs td.log-reason { font-size: 13px; max-width: 220px; }

/* 事件类型标签 */
.ev-tag {
  display: inline-block;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text-2);
  white-space: nowrap;
}
.ev-tag.ev-login    { background: #eff6ff; color: #1d4ed8; }
.ev-tag.ev-logout   { background: #f4f4f5; color: #52525b; }
.ev-tag.ev-register { background: #ecfdf5; color: #047857; }
.ev-tag.ev-forgot   { background: #fffbeb; color: #b45309; }

/* 成功 / 失败结果标签 */
.res-tag {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.6;
  padding: 1px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.res-ok   { background: #ecfdf5; color: #059669; }
.res-fail { background: #fff1f2; color: #e11d48; }

/* 可疑 IP 风险等级 */
.risk-tag {
  display: inline-block;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 1px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.risk-low  { background: #f4f4f5; color: #71717a; }
.risk-mid  { background: #fffbeb; color: #b45309; }
.risk-high { background: #fff1f2; color: #e11d48; font-weight: 600; }

/* 失败数异常时统计卡转红 */
.tile-danger {
  background-image: linear-gradient(135deg, #f43f5e, #f97316);
  border-color: transparent;
  color: #fff;
}
.tile-danger .tile-num,
.tile-danger .tile-label,
.tile-danger .tile-sub { color: #fff; }
.tile-danger .tile-sub { opacity: .9; }
.tile-danger:hover { box-shadow: 0 16px 40px -14px rgba(244, 63, 94, .6); }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 0 2px;
  flex-wrap: wrap;
}
.pager-btn {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font-size: 13.5px;
  text-decoration: none;
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.pager-btn:hover { background: var(--soft); color: var(--text); transform: translateY(-1px); }
.pager-info { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============================================================
   扫码入库（管理后台）
   设计要点：输入框要足够大、反馈要足够显眼 —— 仓库环境里
   操作员是「扫一下瞄一眼」的节奏，不能靠仔细阅读小字
   ============================================================ */

/* 补一个「警告」态提示条（重复扫描用），补齐 ok / err 之外的一档 */
.alert-warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }

.scan-tools { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 扫码输入区 ---------- */
.scan-form { display: flex; gap: 10px; align-items: stretch; margin: 4px 0 12px; }
.scan-input-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;            /* flex 子项默认 min-width:auto，会被长 placeholder 撑破 */
  display: flex;
  align-items: center;
}
.scan-ico {
  position: absolute;
  left: 16px;
  font-size: 20px;
  color: var(--muted);
  pointer-events: none;
  line-height: 1;
}
.scan-input {
  width: 100%;
  height: 62px;
  padding: 0 16px 0 48px;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text);
  background: var(--card);
  border: 2px solid var(--line-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
/* 占位符要用中文字体栈，不能 inherit（会继承输入框的等宽字体，中文会变成宋体感） */
.scan-input::placeholder {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}
.scan-input:focus { border-color: var(--focus); box-shadow: 0 0 0 4px var(--ring); }
/* 焦点跑丢时的提醒：点击即回到输入框 */
.scan-hint-focus {
  position: absolute;
  right: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  animation: scanPulse 1.6s ease-in-out infinite;
}
@keyframes scanPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.scan-btn {
  flex: 0 0 auto;
  height: 62px;
  padding: 0 26px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* ---------- 结果反馈条：三态一眼可辨 ---------- */
.scan-fb {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: background-color .18s var(--ease), border-color .18s var(--ease);
}
.scan-fb-ico {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 700;
  border-radius: 50%;
  background: var(--soft);
  color: var(--text-2);
}
.scan-fb-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.scan-fb-title { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.3; }
.scan-fb-sub { font-size: 13.5px; color: var(--text-2); line-height: 1.55; word-break: break-all; }
.scan-fb-sub b { font-weight: 700; color: var(--text); }
.scan-sug { color: #b45309; }

.scan-fb-idle .scan-fb-ico { color: var(--muted); }
.scan-fb-ok   { background: #ecfdf5; border-color: #a7f3d0; }
.scan-fb-ok   .scan-fb-ico { background: #d1fae5; color: var(--ok); }
.scan-fb-ok   .scan-fb-title { color: #047857; }
.scan-fb-dup  { background: #fffbeb; border-color: #fde68a; }
.scan-fb-dup  .scan-fb-ico { background: #fef3c7; color: #b45309; }
.scan-fb-dup  .scan-fb-title { color: #b45309; }
.scan-fb-miss,
.scan-fb-bad  { background: #fff1f2; border-color: #fecdd3; }
.scan-fb-miss .scan-fb-ico,
.scan-fb-bad  .scan-fb-ico { background: #ffe4e6; color: var(--danger); }
.scan-fb-miss .scan-fb-title,
.scan-fb-bad  .scan-fb-title { color: var(--danger); }

/* ---------- 摄像头（渐进增强，浏览器支持才出现） ---------- */
/* 取景器：画面比例必须跟摄像头原始画面一致（用 height:auto），
   千万别用 aspect-ratio + object-fit:cover —— 那样 16:9 的流会被裁掉左右两边，
   预览里瞅着对准了、实际解码时那块根本没进画面，典型的「看着有就是不识别」 */
.scan-cam { margin-top: 12px; text-align: center; }
.cam-stage {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 480px;
  line-height: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}
.cam-stage video { display: block; width: 100%; height: auto; }
/* 取景区：框外压暗，让操作员明确知道「该往哪儿放」 */
.cam-frame {
  position: absolute;
  left: 13%; top: 13%;
  width: 74%; height: 74%;
  border: 2px dashed rgba(255, 255, 255, .8);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .3);
  pointer-events: none;
}
/* 扫描线：让操作员看到「系统确实在扫」，而不是干瞪眼 */
.cam-line {
  position: absolute;
  left: 13%; width: 74%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, .95), transparent);
  animation: camSweep 1.9s ease-in-out infinite;
  pointer-events: none;
}
@keyframes camSweep {
  0%, 100% { top: 14%; }
  50%      { top: 85%; }
}
.scan-cam-tip { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.cam-diag {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  word-break: break-all;
}
.cam-quality {
  display: inline-block;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  margin-top: 8px;
}
.cam-acts {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
@media (prefers-reduced-motion: reduce) { .cam-line { animation: none; top: 50%; } }

/* ---------- 扫码记录表 ---------- */
.table-scan { width: 100%; min-width: 0; }
/* 单号列：正常单号不折行；粘贴进来的超长串省略号截断，别把表格撑出横向滚动 */
.table-scan td.cell-no {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scan-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  padding: 1px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.scan-tag-ok   { background: #d1fae5; color: #047857; }
.scan-tag-dup  { background: #fef3c7; color: #b45309; }
.scan-tag-miss { background: #ffe4e6; color: var(--danger); }
.scan-tag-undo { background: var(--soft); color: var(--text-2); }

/* 状态小胶囊（补 .st-tab 之外的可内联使用版本） */
.st-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  padding: 1px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--soft);
  color: var(--text-2);
}
.st-tag.st-pending  { background: #f1f5f9; color: #475569; }
.st-tag.st-instock  { background: #dbeafe; color: #1d4ed8; }
.st-tag.st-settling { background: #fef3c7; color: #b45309; }
.st-tag.st-settled  { background: #d1fae5; color: #047857; }

/* 新扫进来的行闪一下，方便确认「刚才那条进来了」 */
.scan-row-new { animation: scanRowIn .9s var(--ease); }
@keyframes scanRowIn {
  0%   { background: rgba(59, 130, 246, .16); }
  100% { background: transparent; }
}

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .scan-form { gap: 8px; }
  .scan-input { height: 56px; font-size: 18px; padding: 0 12px 0 42px; }
  .scan-input::placeholder { font-size: 13.5px; }
  .scan-ico { left: 13px; font-size: 17px; }
  .scan-btn { height: 56px; padding: 0 18px; font-size: 15px; }
  .scan-fb { padding: 12px 14px; gap: 11px; }
  .scan-fb-ico { width: 34px; height: 34px; font-size: 18px; }
  .scan-fb-title { font-size: 15.5px; }
  .scan-fb-sub { font-size: 12.5px; }
  .scan-hint-focus { right: 8px; font-size: 11px; }
  /* 窄屏下表格横向滚动，但列不许折成竖排 */
  .scope-admin .table-scan { min-width: 720px !important; }
  .scope-admin .table-scan td.mono,
  .scope-admin .table-scan td.nowrap,
  .scope-admin .table-scan td .scan-tag,
  .scope-admin .table-scan td .st-tag { white-space: nowrap; }
}
