/* ==========================================================================
   仓储台账 · 企业简洁风（Corporate Clean）
   浅灰蓝画布 + 白色卡片 + 1px 极浅描边 + 单主蓝。
   层次只靠描边与两级阴影；hover 上浮 2px，active 缩到 .98，动效不超过 200ms。
   ========================================================================== */

:root {
  /* ---- 风格 token（提示词原值） */
  --color-corporate-blue: #1e40af;
  --color-slate-mist: #f8fafc;
  --color-action-blue: #3b82f6;
  --color-slate: #64748b;
  --color-confirm-green: #10b981;
  --color-hint-violet: #c559f0;

  /* ---- 语义色：一个主蓝，不出现第二种蓝做主色 */
  --primary: #1e40af;
  --primary-hover: #1b3796;
  --on-primary: #ffffff;
  --primary-container: #e8eefb;
  --on-primary-container: #1e40af;
  --primary-soft: #eff4fd;

  --secondary-container: #f1f5f9;
  --on-secondary-container: #334155;

  --error: #dc2626;
  --on-error: #ffffff;
  --error-container: #fef2f2;
  --on-error-container: #b91c1c;

  --success: #10b981;
  --success-container: #ecfdf5;
  --on-success-container: #047857;

  --tertiary: #b45309;
  --tertiary-container: #fffbeb;
  --on-tertiary-container: #92400e;

  /* ---- 表面：画布与卡片差一档，白卡才能浮起来 */
  --surface: #f8fafc;
  --surface-1: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #eef2f7;
  --surface-4: #e6ebf2;

  --on-surface: #0f172a;
  --on-surface-variant: #64748b;
  --outline: #94a3b8;
  --outline-variant: #eef2f7;
  --line: #e5e7eb;
  --line-strong: #d1d5db;

  --scrim: rgba(15, 23, 42, 0.42);

  /* ---- 两级阴影：rest 与 hover，不用更重的 */
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-3: 0 12px 32px rgba(15, 23, 42, 0.12);
  /* 旧样式里可能还引用着这几个名字，这里统一指到同一套阴影上 */
  --nm-raised: var(--shadow-1);
  --nm-raised-sm: var(--shadow-1);
  --nm-raised-xs: none;
  --nm-hover: var(--shadow-2);
  --nm-inset: none;
  --nm-inset-sm: none;
  --nm-inset-xs: none;
  --nm-press: none;

  /* ---- 圆角：卡片 12，控件 8，标签全圆 */
  --r-xl: 16px;
  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;

  --font: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: var(--font);
  --mono: "JetBrains Mono", "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;

  /* 库位热度：同一支企业蓝按透明度递进，不做彩虹 */
  --lvl0: transparent;
  --lvl1: rgba(30, 64, 175, 0.07);
  --lvl2: rgba(30, 64, 175, 0.16);
  --lvl3: rgba(30, 64, 175, 0.28);
  --lvl4: rgba(30, 64, 175, 0.42);
  --lvl5: rgba(30, 64, 175, 0.58);
  --lvl-ink: #ffffff;

  --pos-ink: #047857;
  --switch-track: #cbd5e1;
  --switch-knob: #ffffff;

  /* ---- 浅色底纹：hover、选中、警示。夜间模式整组换掉，
     以前这些地方写死 #f7fafd / #fff8f8，夜里看着就是一片泛白 */
  --tint-1: #f7fafd;          /* 行 hover / 最浅一档库存 */
  --tint-2: #f8fbff;          /* 选中格 */
  --tint-3: #f4f7fc;          /* 多层货位 */
  --tint-blue-line: #cfe0fb;
  --tint-blue-line-strong: #bcd2f7;
  --tint-mid-bg: #e6eefb;     /* 中间层标签 */
  --tint-mid-ink: #365a8c;
  --tint-red-bg: #fff8f8;
  --tint-red-bg-2: #fffbfb;
  --tint-red-line: #f3cccc;
  --tint-red-strong: #f7c8c8;
  --tint-amber-line: #f0e0b8;
  --warn-ink: #a16207;        /* 提醒类文字（旧库存、警告） */
  --warn-bg: #fffbeb;
  --check-ink: #ffffff;       /* 勾选标记 */

  --nav-w: 240px;
  --bar-h: 64px;
  --page-max: 1480px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 夜间：石墨灰底（不带蓝调），只留主蓝做强调色 */
[data-theme="dark"] {
  --color-slate-mist: #101113;

  --primary: #7fa8ff;
  --primary-hover: #9cbcf7;
  --on-primary: #0c1018;
  --primary-container: #232c3a;
  --on-primary-container: #c6d8f5;
  --primary-soft: #1c1f25;

  --secondary-container: #232529;
  --on-secondary-container: #cfd1d5;

  --error: #f87171;
  --on-error: #2a0d0d;
  --error-container: #3a2020;
  --on-error-container: #fecaca;

  --success: #34d399;
  --success-container: #16302a;
  --on-success-container: #a7f3d0;

  --tertiary: #fbbf24;
  --tertiary-container: #33290f;
  --on-tertiary-container: #fde68a;

  --surface: #101113;
  --surface-1: #17181a;
  --surface-2: #1e1f22;
  --surface-3: #25262a;
  --surface-4: #2d2e33;

  --on-surface: #ececee;
  --on-surface-variant: #a3a5aa;
  --outline: #4c4e53;
  --outline-variant: #26272b;
  --line: #26272b;
  --line-strong: #35373c;

  --scrim: rgba(8, 8, 9, 0.68);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.42);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.48);
  --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.56);

  --lvl1: rgba(127, 168, 255, 0.1);
  --lvl2: rgba(127, 168, 255, 0.2);
  --lvl3: rgba(127, 168, 255, 0.32);
  --lvl4: rgba(127, 168, 255, 0.46);
  --lvl5: rgba(127, 168, 255, 0.62);
  --lvl-ink: #0a1017;

  --pos-ink: #34d399;
  --switch-track: #3a3c41;
  --switch-knob: #e2e3e6;

  --tint-1: #1b1c1f;
  --tint-2: #1c1f24;
  --tint-3: #1d1f23;
  --tint-blue-line: #2f3a4c;
  --tint-blue-line-strong: #3c4a63;
  --tint-mid-bg: #262f3c;
  --tint-mid-ink: #a9c3e6;
  --tint-red-bg: rgba(248, 113, 113, 0.08);
  --tint-red-bg-2: rgba(248, 113, 113, 0.06);
  --tint-red-line: #4a2b2b;
  --tint-red-strong: rgba(248, 113, 113, 0.26);
  --tint-amber-line: #463718;
  --warn-ink: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.08);
  --check-ink: #0c1018;
}

/* ==========================================================================
   基础
   ========================================================================== */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

b, strong { font-weight: 600; }

code, kbd, samp { font-family: var(--mono); font-size: 12px; }

code {
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--on-surface);
}

button { font-family: inherit; font-size: inherit; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

::selection { background: rgba(59, 130, 246, 0.22); }

/* 焦点环：统一 2px 偏移，键盘用户必须看得见 */
:focus-visible { outline: 2px solid var(--color-action-blue); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: #c7d2e0 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--outline);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--outline); background-clip: padding-box; }

/* ==========================================================================
   应用外壳
   ========================================================================== */

#shell { min-height: 100%; }

.appbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 0 14px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}

.appbar-brand { display: flex; align-items: center; gap: 10px; margin-right: 8px; min-width: 0; }

.appbar-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--primary-container);
  color: var(--on-primary-container);
  flex: none;
}

.appbar-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.appbar-sub { font-size: 11px; color: var(--on-surface-variant); letter-spacing: 0.04em; }
.appbar-spacer { flex: 1; }
.appbar-actions { display: flex; align-items: center; gap: 4px; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  margin-left: 4px;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.avatar:hover { background: var(--primary-soft); border-color: var(--tint-blue-line-strong); }
.avatar:active { transform: scale(0.98); }

.navdrawer {
  position: fixed;
  top: var(--bar-h);
  bottom: 0;
  left: 0;
  width: var(--nav-w);
  padding: 14px 12px 20px;
  background: var(--surface-1);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 180ms var(--ease);
}

.main {
  margin-left: var(--nav-w);
  padding: calc(var(--bar-h) + 24px) 24px 64px;
  min-height: 100vh;
  transition: margin-left 180ms var(--ease);
}

/* 顶部提示条（初始密码未改、服务端版本过期等）：贴着顶栏下方，可关闭 */
.notice-bar {
  position: fixed;
  top: var(--bar-h);
  left: var(--nav-w);
  right: 0;
  z-index: 39;
  padding: 8px 20px;
  background: var(--tertiary-container);
  border-bottom: 1px solid var(--tint-amber-line);
  color: var(--on-tertiary-container);
  transition: left 180ms var(--ease);
}
body.nav-collapsed .notice-bar { left: 0; }
.notice-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.5;
}
.notice-inner > span { flex: 1; min-width: 0; }
.notice-inner .btn { flex: none; background: var(--surface-1); border-color: var(--line-strong); }
.notice-x {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}
.notice-x:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
body.has-notice .main { padding-top: calc(var(--bar-h) + 76px); }
[data-theme="dark"] .notice-bar { border-bottom-color: #3a3020; }

/* 桌面端点三条杠收起侧栏 */
body.nav-collapsed .navdrawer { transform: translateX(-100%); }
body.nav-collapsed .main { margin-left: 0; }

.page { max-width: var(--page-max); margin: 0 auto; }

.scrim {
  position: fixed;
  inset: var(--bar-h) 0 0 0;
  background: var(--scrim);
  z-index: 34;
  opacity: 0;
  transition: opacity 160ms var(--ease);
}
.scrim.show { opacity: 1; }

/* ---- 导航项 */

.side-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--on-surface-variant);
  cursor: pointer;
  font-size: 12px;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}
.side-search:hover { border-color: var(--line-strong); background: var(--surface-1); color: var(--on-surface); }
.side-search span { flex: 1; text-align: left; }
.side-search kbd {
  font-family: var(--font);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--on-surface-variant);
}

.nav-group { margin-top: 10px; }
.nav-label {
  padding: 0 8px 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  margin-bottom: 2px;
  border-radius: var(--r-md);
  color: var(--on-surface-variant);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.nav-item svg { flex: none; opacity: 0.75; }
.nav-item:hover { background: var(--surface-2); color: var(--on-surface); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; color: var(--primary); }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  line-height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--error-container);
  color: var(--on-error-container);
  font-weight: 600;
}

.side-foot {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--on-surface-variant);
}
.side-foot b { font-weight: 600; color: var(--on-surface); }

@media (max-width: 960px) {
  .navdrawer {
    width: 264px;
    transform: translateX(-102%);
    box-shadow: var(--shadow-3);
  }
  .navdrawer.open { transform: translateX(0); }
  .main { margin-left: 0; padding: calc(var(--bar-h) + 18px) 14px 88px; }
  body.nav-collapsed .main { margin-left: 0; }
  /* 提示条是按侧栏宽度定位的，手机上没有侧栏，left 240px 会把文字挤成一列竖排 */
  .notice-bar { left: 0; right: 0; padding: 8px 14px; }
  .appbar-sub { display: none; }
}

/* ==========================================================================
   页面头
   ========================================================================== */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.head-left { min-width: 0; }
.page-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.page-head .sub { margin-top: 4px; font-size: 13px; color: var(--on-surface-variant); line-height: 1.6; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.back-link:hover { background: var(--surface-2); color: var(--on-surface); }

@media (max-width: 720px) {
  .page-head { align-items: flex-start; margin-bottom: 16px; }
  .page-head h1 { font-size: 19px; }
  .page-head .sub { font-size: 12px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; justify-content: center; }
}

/* ==========================================================================
   按钮
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--on-surface);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease),
    background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.btn svg { flex: none; }
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: #c3cddc;
  background: var(--surface-1);
}
.btn:active { transform: scale(0.98); box-shadow: var(--shadow-1); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:disabled:hover { transform: none; box-shadow: none; border-color: var(--line-strong); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--on-primary);
}
.btn-primary:active { background: var(--primary-hover); }

.btn-tonal {
  background: var(--primary-soft);
  border-color: #d5e2fb;
  color: var(--on-primary-container);
}
.btn-tonal:hover { background: var(--primary-container); border-color: var(--tint-blue-line-strong); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--on-surface-variant);
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--on-surface);
  box-shadow: none;
  transform: none;
}
.btn-ghost:active { transform: scale(0.98); background: var(--surface-3); }

.btn-danger { background: var(--error); border-color: var(--error); color: var(--on-error); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: var(--on-error); }

.btn-danger-ghost { background: transparent; border-color: var(--tint-red-line); color: var(--on-error-container); box-shadow: none; }
.btn-danger-ghost:hover { background: var(--error-container); border-color: var(--tint-red-line); box-shadow: none; transform: none; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-sm:hover { transform: none; box-shadow: var(--shadow-1); }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-icon { width: 30px; height: 30px; padding: 0; }
.btn-sm.btn-icon { width: 28px; height: 28px; padding: 0; }

.btn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-row .spacer { flex: 1; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease),
    border-color 150ms var(--ease), transform 150ms var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--on-surface); border-color: var(--line); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn.danger:hover { background: var(--error-container); color: var(--on-error-container); border-color: var(--tint-red-line); }

.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  z-index: 30;
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease);
}
.fab:active { transform: scale(0.96); box-shadow: var(--shadow-1); }

/* ==========================================================================
   卡片
   ========================================================================== */

.card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 20px;
  transition: box-shadow 150ms var(--ease), transform 150ms var(--ease);
}
.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .hint { font-size: 12px; color: var(--on-surface-variant); }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

details.card > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after {
  content: "+";
  margin-left: auto;
  color: var(--on-surface-variant);
  font-size: 14px;
}
details.card[open] > summary::after { content: "−"; }
details.card[open] > summary { margin-bottom: 12px; }

.card-body { padding: 0; }
.card-body p { margin: 0 0 8px; font-size: 13px; color: var(--on-surface-variant); line-height: 1.65; }
.card-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--on-surface-variant);
}
.card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 16px; }
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 1080px) {
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
}

/* ---- 统计卡 */

.stat {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  min-width: 0;
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat .k {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--on-surface-variant);
}
.stat .v {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat .v small { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); margin-left: 4px; }
.stat .meta { margin-top: 4px; font-size: 12px; color: var(--on-surface-variant); }

/* 强调卡：仍是白卡 + 1px 描边，只用 3px 顶条和数值颜色区分主次，不整块染底色 */
.stat.accent { border-color: var(--tint-blue-line-strong); box-shadow: var(--shadow-1), inset 0 3px 0 var(--color-corporate-blue); }
.stat.accent .v { color: var(--primary); }
.stat.accent .k { color: var(--on-surface-variant); }
.stat.accent .bar i { background: var(--primary); }

.stat.warn { border-color: var(--tint-red-line); box-shadow: var(--shadow-1), inset 0 3px 0 #c65b5b; }
.stat.warn .v { color: var(--on-error-container); }
.stat.warn .k, .stat.warn .meta, .stat.warn .v small { color: #b15454; }

.stat.caution { border-color: var(--tint-amber-line); box-shadow: var(--shadow-1), inset 0 3px 0 #d8a441; }
.stat.caution .v { color: var(--on-tertiary-container); }
.stat.caution .k, .stat.caution .meta, .stat.caution .v small { color: #9a7434; }

.bar {
  height: 5px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width 220ms var(--ease); }

/* ---- 徽标 / 标签 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: var(--primary-container);
  color: var(--on-primary-container);
}
.badge-in { background: var(--success-container); color: var(--on-success-container); }
.badge-out { background: var(--error-container); color: var(--on-error-container); }
.badge-soft { background: var(--surface-2); color: var(--on-surface-variant); border: 1px solid var(--line); }
.badge-zero { background: transparent; color: var(--on-surface-variant); border: 1px solid var(--line-strong); }
.badge-neg { background: var(--error-container); color: var(--on-error-container); }
.badge-warn { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.badge-defect { background: var(--error-container); color: var(--on-error-container); }
.badge-defect::before, .badge-in::before, .badge-out::before, .badge-warn::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.chip-key {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--on-surface);
}

.role-badge {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
}
.role-superadmin { background: var(--primary-container); color: var(--on-primary-container); }
.role-admin { background: var(--success-container); color: var(--on-success-container); }
.role-member { background: var(--surface-2); color: var(--on-surface-variant); border: 1px solid var(--line); }

/* ---- 库位标签 */

.loc-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--on-surface);
  white-space: nowrap;
}
.loc-tag b { font-weight: 600; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.01em; }
.loc-tag i {
  font-style: normal;
  font-family: var(--font);
  font-size: 10px;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  background: var(--surface-3);
  color: var(--on-surface-variant);
}
.loc-tag.is-up { border-color: var(--tint-blue-line); background: var(--primary-soft); color: var(--on-primary-container); }
.loc-tag.is-up i { background: var(--primary-container); color: var(--on-primary-container); }
.loc-tag.is-mid { border-color: var(--tint-blue-line); background: var(--tint-2); color: var(--tint-mid-ink); }
.loc-tag.is-mid i { background: var(--tint-mid-bg); color: var(--tint-mid-ink); }
.loc-tag.is-defect { border-color: var(--tint-red-line); background: var(--error-container); color: var(--on-error-container); }
.loc-tag.is-defect i { background: var(--error-container); color: var(--on-error-container); }
.loc-tag.sm { height: 20px; padding: 0 6px; font-size: 11px; }
.loc-tag.sm i { font-size: 9.5px; }

.lv-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 4px;
  font-family: var(--font);
  font-size: 10px;
  line-height: 15px;
  background: var(--surface-3);
  color: var(--on-surface-variant);
  vertical-align: 1px;
}
.lv-tag.up { background: var(--primary-container); color: var(--on-primary-container); }

.party { font-weight: 500; display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 供应商与客户同色：跟随主题（白天黑字 / 夜间白字），不再单独写死蓝色 */
.party.is-supplier { color: inherit; }

/* ==========================================================================
   表单
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}
.field .req { color: var(--error); margin-left: 2px; }

.input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--on-surface);
  font-size: 14px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
  appearance: none;
}
.input::placeholder { color: #9aa8bb; }
.input:hover { border-color: #b9c4d4; }
.input:focus {
  outline: none;
  border-color: var(--color-action-blue);
  /* 环与元素之间留 2px offset，但不改变盒子尺寸 */
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--color-action-blue);
}
.input:disabled { background: var(--surface-2); color: var(--on-surface-variant); cursor: not-allowed; }

textarea.input { height: auto; min-height: 78px; padding: 9px 11px; line-height: 1.65; resize: vertical; }
select.input {
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l7 7 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.input-sm { height: 32px; font-size: 13px; }
.input-date { width: auto; min-width: 148px; }

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.45;
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 0.75; }

.hint { font-size: 12px; color: var(--on-surface-variant); line-height: 1.55; }
.hint.is-warn, .is-warn { color: var(--on-error-container); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid.has-match { border-left: 2px solid #cfe0fb; padding-left: 12px; margin-left: -14px; }

.form-section {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--on-surface-variant);
  text-transform: uppercase;
}
.form-section:first-child { margin-top: 0; }

@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---- 密码框小眼睛 */
.pw { position: relative; display: block; }
.pw .input { padding-right: 40px; }
.pw-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.pw-eye:hover { background: var(--surface-2); color: var(--on-surface); }
.pw-eye.on { color: var(--primary); }

/* ---- 勾选框 */
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input {
  appearance: none;
  width: 17px;
  height: 17px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-1);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--check-ink);
  border-bottom: 2px solid var(--check-ink);
  transform: rotate(-45deg) translateY(-1px);
}

/* ---- 开关 */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--switch-track);
  cursor: pointer;
  transition: background-color 150ms var(--ease), box-shadow 150ms var(--ease);
  flex: none;
  /* 关闭态也要看得出能点：浅灰实底 + 明确的描边 + 悬停变蓝，避免被当成禁用 */
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1.5px var(--outline);
}
.switch:hover { box-shadow: inset 0 0 0 1.5px var(--color-action-blue), 0 0 0 3px var(--primary-soft); }
.switch:active { transform: scale(0.96); }
.switch:focus-visible { outline: none; box-shadow: inset 0 0 0 1.5px var(--color-action-blue), 0 0 0 3px var(--primary-soft); }
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--switch-knob);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition: transform 150ms var(--ease);
}
.switch.on { background: var(--primary); box-shadow: none; }
.switch.on::after { transform: translateX(16px); }
[data-theme="dark"] .switch { background: #2b2f36; box-shadow: inset 0 0 0 1.5px #6b7280; }
[data-theme="dark"] .switch.on { background: #4b7ae0; }
[data-theme="dark"] .switch.on::after { background: #f2f4f8; }
[data-theme="dark"] .switch.on { background: var(--primary); box-shadow: none; }
.switch:disabled { opacity: 0.6; cursor: not-allowed; }
.switch:disabled:hover { box-shadow: none; }

/* ---- 图片上传 */
.inline-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.uploader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.uploader .preview {
  width: 54px;
  height: 54px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-1);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  color: var(--on-surface-variant);
}
.uploader .preview img { width: 100%; height: 100%; object-fit: cover; }
.uploader .side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.uploader .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.uploader small { font-size: 11.5px; color: var(--on-surface-variant); }

/* ---- 图片 / 视频（可多张） */
.media-field {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 8px;
  transition: border-color 150ms var(--ease);
}
.media-field:hover { border-color: var(--tint-blue-line-strong); }
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 6px;
}
.media-grid:empty { display: none; }
.media-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 130ms var(--ease), transform 130ms var(--ease);
}
.media-item:hover { border-color: var(--color-action-blue); transform: translateY(-1px); }
.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.media-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(15, 23, 42, 0.34);
  pointer-events: none;
}
.media-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 130ms var(--ease), background-color 130ms var(--ease);
}
.media-item:hover .media-x { opacity: 1; }
.media-x:hover { background: var(--error); }
.media-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.media-foot small { font-size: 11.5px; color: var(--on-surface-variant); }

/* 表格里的图片 / 视频缩略 */
.thumb-link { position: relative; display: inline-block; line-height: 0; }
.media-count {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 9.5px;
  font-style: normal;
  line-height: 15px;
  text-align: center;
}
.media-ico {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--on-surface-variant);
}

/* 大图 / 视频预览 */
/* 双类名是为了压过后面的 .overlay：同权重时后者会把 z-index 和底色覆盖回去 */
.overlay.lightbox { background: rgba(8, 9, 11, 0.84); display: grid; place-items: center; padding: 32px; z-index: 130; }
.overlay.lightbox .lightbox-stage { max-width: min(92vw, 900px); max-height: 88vh; display: grid; place-items: center; }
.overlay.lightbox .lightbox-stage img,
.overlay.lightbox .lightbox-stage video {
  max-width: 100%;
  max-height: 88vh;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  background: #000;
}

/* 同一分组被拆开时补一条分隔线，避免小标题重复出现 */
.form-sep {
  grid-column: 1 / -1;
  height: 1px;
  margin: 6px 0;
  background: var(--line);
}

/* ---- 直接进不良品区 */
.defect-bar {
  margin-bottom: 14px;
  border: 1px solid var(--tint-red-line);
  border-radius: var(--r-md);
  background: var(--error-container);
  padding: 10px 12px;
}
.dbar { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.dbar input {
  appearance: none;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  border: 1px solid var(--tint-red-line);
  border-radius: 4px;
  background: var(--surface-1);
  display: grid;
  place-items: center;
  flex: none;
  cursor: pointer;
}
.dbar input:checked { background: var(--error); border-color: var(--error); }
.dbar input:checked::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--check-ink);
  border-bottom: 2px solid var(--check-ink);
  transform: rotate(-45deg) translateY(-1px);
}
.dbar-mark { color: var(--on-error-container); display: grid; place-items: center; margin-top: 1px; }
.dbar-text { display: flex; flex-direction: column; gap: 2px; }
.dbar-text b { font-size: 13px; color: var(--on-error-container); }
.dbar-text em { font-style: normal; font-size: 12px; color: var(--on-error-container); line-height: 1.5; }

/* ==========================================================================
   工具栏 / 搜索 / 分段 / 页签
   ========================================================================== */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }
.toolbar .count { font-size: 12.5px; color: var(--on-surface-variant); white-space: nowrap; }
.toolbar .count b { color: var(--on-surface); font-weight: 600; }
.toolbar .dash { width: 1px; height: 20px; background: var(--line); }
.toolbar > .input { width: auto; }
.toolbar select.input { width: auto; min-width: 120px; }
.toolbar .input-date { width: auto; }

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  flex: 1 1 240px;
  max-width: 420px;
  min-width: 210px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--on-surface-variant);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.search:focus-within {
  border-color: var(--color-action-blue);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--color-action-blue);
}
.search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--on-surface);
}
.search input::placeholder { color: #9aa8bb; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  gap: 2px;
}
.seg button {
  height: 26px;
  padding: 0 11px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.seg button:hover { color: var(--on-surface); }
.seg button.active { background: var(--surface-1); color: var(--primary); box-shadow: var(--shadow-1); }

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  position: relative;
  padding: 8px 12px 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms var(--ease);
}
.tab:hover { color: var(--on-surface); }
.tab.active { color: var(--primary); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
}

/* ==========================================================================
   年月选择器
   ========================================================================== */

.period { position: relative; display: inline-block; }

.period-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--on-surface);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}
.period-btn:hover { border-color: #b9c4d4; background: var(--surface-2); }
.period.open .period-btn {
  border-color: var(--color-action-blue);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--color-action-blue);
}
.period-btn .p-label { white-space: nowrap; }
.period-btn.is-set { border-color: #c7d7f5; background: var(--primary-soft); color: var(--on-primary-container); font-weight: 500; }
.period-btn svg { color: var(--on-surface-variant); transition: transform 160ms var(--ease); }
.period.open .period-btn svg { transform: rotate(180deg); }

/* 固定定位挂在 body 上，永远盖在表格与卡片之上。
   z-index 110：必须高于抽屉(91)/弹窗(92)/菜单(95)，否则在表单抽屉里
   日期面板会被整个盖住——看起来就是「点了没反应」。低于吐司(120)。 */
.period-pop {
  position: fixed;
  z-index: 110;
  width: 248px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-3);
  animation: pop-in 140ms var(--ease);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.pp-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 10px; }
.pp-quick button {
  height: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--on-surface-variant);
  font-size: 11.5px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.pp-quick button:hover { background: var(--primary-soft); color: var(--on-primary-container); border-color: var(--tint-blue-line); }
.pp-quick button:active { transform: scale(0.98); }

.pp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
}
.pp-head b { font-size: 13px; font-weight: 600; }
.pp-nav {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  color: var(--on-surface-variant);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.pp-nav:hover { background: var(--surface-2); color: var(--on-surface); }
.pp-nav:active { transform: scale(0.96); }

.pp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pp-month {
  position: relative;
  height: 30px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--on-surface);
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.pp-month:hover { background: var(--primary-soft); color: var(--on-primary-container); }
.pp-month.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 500; }
.pp-month.is-now::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--color-action-blue);
}
.pp-month.on.is-now::after { background: #fff; }

/* 导出弹窗：月份 4 列，整年单独一行 */
.pp-grid.export-months { grid-template-columns: repeat(4, 1fr); }
.pp-grid.export-months .pp-month.is-whole { grid-column: 1 / -1; }

.pp-foot { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.pp-clear, .pp-whole {
  flex: 1;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  color: var(--on-surface-variant);
  font-size: 12px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.pp-clear:hover, .pp-whole:hover { background: var(--surface-2); color: var(--on-surface); }
.pp-clear:active, .pp-whole:active { transform: scale(0.98); }
.pp-whole { color: var(--primary); border-color: #d5e2fb; background: var(--primary-soft); }

/* ==========================================================================
   表格
   ========================================================================== */

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  max-width: 100%;
}
.table-wrap.short { max-height: 420px; }
.table-wrap.tall { max-height: 70vh; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--on-surface-variant);
  white-space: nowrap;
}

tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--on-surface);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 120ms var(--ease); }
tbody tr:hover td { background: var(--tint-1); }
tbody tr.is-click { cursor: pointer; }
tbody tr.neg td { background: var(--tint-red-bg); }
tbody tr.defect-row td { background: var(--tint-red-bg-2); }

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
/* 编号、日期这类短字段绝不能折行：一旦允许换行，浏览器会把列压到几十像素，
   HD-300-WH 能折成三行，整张表被撑到几倍高。 */
td.mono { white-space: nowrap; }
td.muted, .muted { color: var(--on-surface-variant); }
td.wrap { white-space: normal; min-width: 240px; }
.nowrap { white-space: nowrap; }

.stick-col { position: sticky; left: 0; z-index: 1; background: var(--surface-1); }
thead th.stick-col { z-index: 3; background: var(--surface-2); }
tbody td.stick-col::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
tbody tr:hover td.stick-col { background: var(--tint-1); }

.qty-cell { font-variant-numeric: tabular-nums; font-weight: 500; }
.qty-pos { color: var(--pos-ink); }
.qty-warn { color: var(--warn-ink, #a16207); }
.qty-neg { color: var(--on-error-container); }
.qty-zero { color: var(--on-surface-variant); }

.cell-strong { font-weight: 600; }
.cell-2l { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-2l b { font-size: 13px; font-weight: 500; }
.cell-2l .sub { font-size: 11.5px; color: var(--on-surface-variant); }

.row-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.danger-text { color: var(--on-error-container); }

.thumb {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  object-fit: cover;
  border: 1px solid var(--line);
  display: block;
}
.thumb-empty {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 44px 20px;
  text-align: center;
  color: var(--on-surface-variant);
}
.empty svg { color: #b6c2d4; margin-bottom: 2px; }
.empty b { font-size: 14px; font-weight: 500; color: var(--on-surface); }
.empty span { font-size: 12.5px; }

/* ---- 说明卡 */
.tip-card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
}
.tip-card h4 {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
}
.tip-card p {
  margin: 0 0 7px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--on-surface-variant);
}
.tip-card p:last-child { margin-bottom: 0; }
.tip-card code, .card-body p code, .auth-note code { font-size: 11.5px; }

.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  transition: background-color 120ms var(--ease);
}
.mini-row:last-child { border-bottom: none; }
.mini-row:hover { background: var(--surface-2); }
.mini-row .grow { flex: 1; }
.mini-row .t { font-size: 13px; }
.mini-row .s { font-size: 11.5px; color: var(--on-surface-variant); }

.steps { display: flex; flex-direction: column; gap: 10px; }
.step {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--on-surface-variant);
}
.step b { color: var(--on-surface); font-weight: 600; }

/* ---- 日志存储位置 */
.store-info {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
}
.store-info .kv {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.store-info .kv:last-child { border-bottom: none; }
.store-info .kv > span { width: 96px; flex: none; color: var(--on-surface-variant); }
.store-info .kv > b {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  word-break: break-all;
}
.store-info .kv .is-off { color: var(--on-surface-variant); font-family: var(--font); }

/* ==========================================================================
   下拉 / 组合框
   ========================================================================== */

.combo { position: relative; width: 100%; }
.combo-field { width: 100%; }
.combo-input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--on-surface);
  font-size: 14px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.combo-input::placeholder { color: #9aa8bb; }
.combo-input:hover { border-color: #b9c4d4; }
.combo-input:focus {
  outline: none;
  border-color: var(--color-action-blue);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--color-action-blue);
}
.combo.is-open .combo-input { border-color: var(--color-action-blue); }
.combo-code { font-family: var(--mono); }

.combo-pop {
  position: absolute;
  z-index: 70;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 268px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-3);
  display: none;
}
.combo-pop.up { top: auto; bottom: calc(100% + 4px); }
.combo-pop.show { display: block; }

.combo-list { padding: 4px; }
.combo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}
.combo-item:hover { background: var(--surface-2); }
.combo-item.active { background: var(--primary-soft); }

.opt-text { flex: 1; min-width: 0; }
.opt-code {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opt-spec {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opt-spec i { color: #b6c2d4; font-style: normal; }
.opt-none { color: var(--on-surface-variant); font-size: 12px; }
.opt-side {
  flex: none;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--on-success-container);
  font-variant-numeric: tabular-nums;
}
.opt-side.is-zero { color: var(--on-surface-variant); font-weight: 400; }

.combo-empty { padding: 14px 12px; font-size: 12.5px; color: var(--on-surface-variant); text-align: center; }
.combo-foot { border-top: 1px solid var(--line); padding: 4px; }
.combo-free {
  width: 100%;
  padding: 7px 9px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--primary);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.combo-free:hover { background: var(--primary-soft); }

/* ---- 编号匹配面板 */
.match-host { grid-column: 1 / -1; }
.match {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}
.match-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
}
.match-thumb {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-1);
  flex: none;
}
.match-thumb.is-empty { display: grid; place-items: center; color: var(--on-surface-variant); }
.match-title { min-width: 0; flex: 1; }
.match-code { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.match-spec {
  font-size: 11.5px;
  color: var(--on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match-nums { display: flex; gap: 14px; flex: none; }
.match-nums div { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; }
.match-nums span { font-size: 10.5px; color: var(--on-surface-variant); }
.match-nums b { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.match-body {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}
.match-label { font-size: 11px; color: var(--on-surface-variant); margin-right: 2px; }
.match-none { font-size: 12px; color: var(--on-surface-variant); }

.loc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--on-surface);
  cursor: pointer;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}
.loc-chip:hover { border-color: var(--color-action-blue); background: var(--primary-soft); }
.loc-chip.is-defect { border-color: var(--tint-red-line); color: var(--on-error-container); }
.loc-chip b { font-weight: 600; color: var(--primary); }

/* 匹配到编号后给表单一条左侧提示，但绝不折叠任何字段 */
.form-grid.has-match { border-left-color: var(--tint-blue-line); }

.flash { animation: flash-bg 900ms var(--ease); }
@keyframes flash-bg {
  0% { background-color: var(--tint-1); box-shadow: 0 0 0 2px var(--tint-blue-line); }
  100% { background-color: var(--surface-1); box-shadow: none; }
}

/* ==========================================================================
   抽屉 / 弹窗 / 菜单 / 命令面板
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 160ms var(--ease);
  z-index: 90;
}
.overlay.show { opacity: 1; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 560px;
  max-width: 94vw;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  z-index: 91;
  transform: translateX(100%);
  transition: transform 180ms var(--ease);
}
.drawer.show { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 16px; font-weight: 600; }
.drawer-head .sub { margin-top: 2px; font-size: 12px; color: var(--on-surface-variant); }
.drawer-head .icon-btn { margin-left: auto; flex: none; }

.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 20px; }
.drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 440px;
  max-width: 92vw;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  transform: translate(-50%, -46%) scale(0.98);
  opacity: 0;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  z-index: 92;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}
.modal.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal.wide { width: 560px; }

.modal-body { padding: 18px; overflow-y: auto; }
.modal-body h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.modal-body p { margin: 0 0 12px; font-size: 13px; line-height: 1.65; color: var(--on-surface-variant); }
.modal-body b { color: var(--on-surface); font-weight: 600; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.menu {
  position: fixed;
  z-index: 95;
  min-width: 178px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-3);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease);
}
.menu.show { opacity: 1; transform: translateY(0); }

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--on-surface);
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--on-error-container); }
.menu-item.danger:hover { background: var(--error-container); }
.menu-sep { height: 1px; margin: 4px 2px; background: var(--line); }
.menu-label { padding: 6px 9px; font-size: 11.5px; color: var(--on-surface-variant); }

.palette {
  position: fixed;
  top: 12vh;
  left: 50%;
  width: 560px;
  max-width: 92vw;
  transform: translateX(-50%) translateY(-8px);
  opacity: 0;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  z-index: 96;
  transition: opacity 150ms var(--ease), transform 150ms var(--ease);
  overflow: hidden;
}
.palette.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.palette-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--on-surface-variant);
}
.palette-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--on-surface);
}
.palette-list { max-height: 52vh; overflow: auto; padding: 6px; }
.palette-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  cursor: pointer;
}
.palette-row:hover, .palette-row.active { background: var(--primary-soft); }
.palette-empty { padding: 26px 12px; text-align: center; font-size: 12.5px; color: var(--on-surface-variant); }
.palette-foot {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--on-surface-variant);
}
.palette-foot kbd {
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-1);
  font-size: 10.5px;
}

/* ---- 轻提示 */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  max-width: 340px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-md);
  background: var(--surface-1);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  color: var(--on-surface);
  animation: toast-in 180ms var(--ease);
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--error); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   登录 / 注册
   ========================================================================== */

.auth-page { display: grid; grid-template-columns: 1.02fr 1fr; min-height: 100vh; }

.auth-side {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 40px 44px;
  background: linear-gradient(160deg, #1e40af 0%, #1b3796 58%, #14286e 100%);
  color: #fff;
  overflow: hidden;
}

.auth-brand { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.auth-brand .mark {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.auth-brand b { display: block; font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.auth-brand span { font-size: 10.5px; letter-spacing: 0.14em; opacity: 0.66; }

.auth-hero { margin: auto 0; position: relative; z-index: 1; padding: 32px 0; }
.auth-hero h1 { font-size: 30px; line-height: 1.32; font-weight: 600; letter-spacing: -0.01em; }
.auth-hero p {
  margin: 14px 0 0;
  max-width: 34em;
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.76);
}

.auth-points { display: flex; flex-direction: column; gap: 9px; margin-top: 24px; }
.auth-points div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
}
.auth-points i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  flex: none;
}

.auth-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--surface);
}
.auth-theme { position: absolute; top: 16px; right: 16px; }

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 28px 26px;
}
.auth-card h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.auth-card .lead { margin: 6px 0 18px; font-size: 13px; line-height: 1.65; color: var(--on-surface-variant); }

.auth-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.auth-tabs button {
  flex: 1;
  height: 30px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.auth-tabs button.active { background: var(--surface-1); color: var(--primary); box-shadow: var(--shadow-1); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .input { height: 40px; }
.auth-error {
  padding: 8px 11px;
  border: 1px solid var(--tint-red-line);
  border-radius: var(--r-sm);
  background: var(--error-container);
  color: var(--on-error-container);
  font-size: 12.5px;
}

.auth-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.65;
  color: var(--on-surface-variant);
}
.auth-foot { margin-top: 12px; font-size: 11.5px; color: #9aa8bb; text-align: center; }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .auth-main { min-height: 100vh; }
}

/* ==========================================================================
   仓库可视化
   ========================================================================== */

.visual { max-width: 100%; }
.visual-top {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.vt-title h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.vt-title .sub { margin-top: 4px; font-size: 12.5px; color: var(--on-surface-variant); }

.vt-stats { display: flex; gap: 22px; margin-left: auto; }
.vt-stat { display: flex; flex-direction: column; gap: 1px; }
.vt-stat .k { font-size: 11.5px; color: var(--on-surface-variant); }
.vt-stat .v { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }

.vt-actions { display: flex; align-items: center; gap: 10px; width: 100%; flex-wrap: wrap; }

.legend { display: flex; align-items: center; gap: 6px; margin-right: auto; }
.legend .lg { font-size: 11px; color: var(--on-surface-variant); }
.legend .sw-bar { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.legend .sw-bar i { display: block; width: 13px; height: 11px; }
.legend .sw0 { background: var(--surface-2); }
.legend .sw1 { background: var(--lvl1); }
.legend .sw2 { background: var(--lvl2); }
.legend .sw3 { background: var(--lvl3); }
.legend .sw4 { background: var(--lvl4); }
.legend .sw5 { background: var(--lvl5); }

.visual-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.extra-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px 14px;
  font-size: 12.5px;
  color: #8a5a12;
  background: var(--tertiary-container);
  border: 1px solid var(--tint-amber-line);
  border-radius: var(--r-md);
}
.extra-note b { font-weight: 650; }
.extra-note a { margin-left: auto; color: var(--primary); text-decoration: none; white-space: nowrap; }
.extra-note a:hover { text-decoration: underline; }
[data-theme="dark"] .extra-note { color: var(--on-tertiary-container); border-color: #4a3a17; }
.map-scroll {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 16px;
  overflow: auto;
  max-height: calc(100vh - 210px);
}

.focus-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 11px;
  border: 1px solid var(--tint-blue-line);
  border-radius: var(--r-md);
  background: var(--primary-soft);
  font-size: 12.5px;
  color: var(--on-primary-container);
}
.focus-bar .x { margin-left: auto; cursor: pointer; display: grid; place-items: center; }

.zones { display: flex; flex-direction: column; gap: 14px; }

.zone {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  padding: 12px;
  transition: box-shadow 150ms var(--ease), border-color 150ms var(--ease);
}
.zone.focus { border-color: var(--tint-blue-line-strong); box-shadow: 0 0 0 2px var(--tint-blue-line); }
.zone.is-defect { border-color: var(--tint-red-line); background: var(--tint-red-bg-2); }

.zone-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.zone-code {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-size: 11px;
  font-weight: 600;
  flex: none;
}
.zone.is-defect .zone-code { background: var(--error-container); color: var(--on-error-container); }
.zone-name { font-size: 13px; font-weight: 600; }
.zone-note { font-size: 11.5px; color: var(--on-surface-variant); }
.zone-stat { margin-left: auto; font-size: 11.5px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }

/* align-items:start：同一排里 3 层的货位比 2 层的高，不能让 2 层的框被拉长留出空白 */
.zone-grid { display: grid; gap: 6px; align-items: start; }

/* 一个货位 = 一个大格，里面堆着它的每一层 */
.bay {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 3px;
  min-width: 0;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.bay:hover { border-color: var(--tint-blue-line-strong); box-shadow: var(--shadow-1); }
.bay.is-multi { background: var(--tint-3); border-color: var(--tint-blue-line); }

.bay-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 3px 3px;
}
.bay-no {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--on-surface-variant);
  letter-spacing: 0.02em;
}
.bay-tag {
  margin-left: auto;
  font-size: 9.5px;
  line-height: 13px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.bay-slots { display: flex; flex-direction: column; gap: 2px; }

.cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 30px;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--surface-1);
  color: var(--on-surface);
  font-size: 11.5px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 130ms var(--ease), box-shadow 130ms var(--ease), transform 130ms var(--ease);
}
.cell:hover { border-color: var(--tint-blue-line-strong); box-shadow: var(--shadow-1); }
.cell:active { transform: scale(0.98); }

.cell .lv {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--on-surface-variant);
  white-space: nowrap;
}
.cell.lv-u .lv { color: var(--primary); }
.cell.lv-m1 .lv, .cell.lv-m2 .lv, .cell.lv-m3 .lv { color: #6b5b95; }
.cell .qty { margin-left: auto; padding-left: 6px; font-weight: 600; font-variant-numeric: tabular-nums; }

.cell .fill {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--lvl3);
  transition: width 200ms var(--ease);
}

.cell.s0 { background: var(--surface-2); border-color: var(--line); }
.cell.s0 .qty { color: transparent; }
.cell.s0:hover { background: var(--surface-3); }

.cell.s1 { background: var(--tint-1); }
.cell.s1 .fill { background: var(--lvl1); }
.cell.s2 { background: var(--lvl1); }
.cell.s2 .fill { background: var(--lvl2); }
.cell.s3 { background: var(--lvl2); }
.cell.s3 .fill { background: var(--lvl3); }
.cell.s4 { background: var(--lvl3); }
.cell.s4 .fill { background: var(--lvl4); }
.cell.s5 { background: var(--lvl4); }
.cell.s5 .fill { background: var(--lvl5); }

.cell.s4 .qty, .cell.s5 .qty { color: var(--lvl-ink); }
.cell.s4 .lv, .cell.s5 .lv { color: var(--lvl-ink); }

.cell.neg { background: var(--error-container); border-color: var(--tint-red-line); }
.cell.neg .qty { color: var(--on-error-container); }

.cell.sel { border-color: var(--color-action-blue); box-shadow: 0 0 0 2px var(--primary-soft); }
.cell.match { border-color: var(--color-action-blue); box-shadow: 0 0 0 2px var(--tint-blue-line); }
.zones.has-focus .cell:not(.match) { opacity: 0.42; }
.zones.has-focus .cell.match-ghost { opacity: 0.55; }
.cell.match-ghost { border-style: dashed; border-color: var(--line-strong); }
.zone.target { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-container); }
.focus-bar.is-empty {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--on-surface-variant);
}

.zone.is-defect .cell.s5 { background: var(--tint-red-strong); }

.cell.is-defect-cell { border-color: var(--tint-red-line); }
.cell.is-defect-cell .qty { color: var(--on-error-container); }
.cell.is-defect-cell.has-stock::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--error);
}

/* 不良品区整块都是红的，格子里再点一个红点只会和数量挤在一起 */
.zone.is-defect .cell.is-defect-cell.has-stock::after { display: none; }

@media (max-width: 1100px) {
  .visual-body { grid-template-columns: minmax(0, 1fr); }
  .map-scroll { max-height: none; }
}

/* ---- 右侧检查面板 */
.inspector {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 16px;
  position: sticky;
  top: calc(var(--bar-h) + 16px);
  max-height: calc(100vh - var(--bar-h) - 32px);
  overflow-y: auto;
}

.insp-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.insp-head .code { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.insp-head .sub { margin-top: 2px; font-size: 11.5px; color: var(--on-surface-variant); }
.insp-head .icon-btn { margin-left: auto; flex: none; }

.insp-nums {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}
.insp-nums > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.insp-nums .k { font-size: 11px; color: var(--on-surface-variant); }
.insp-nums .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.insp-sec { padding-top: 12px; }
.insp-sec h4 {
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.insp-foot { margin-top: 12px; }

.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}
.item-row:hover { background: var(--surface-2); }
.item-row .code { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.item-row .meta { font-size: 11px; color: var(--on-surface-variant); }
.item-row .q { margin-left: auto; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.item-row .q.zero { color: var(--on-surface-variant); font-weight: 400; }

/* ==========================================================================
   仓库布局设置
   ========================================================================== */

/* 分区行：名称列给足最小宽度，窄卡片整体横向滚动，不再把「名称」挤扁、和「排数」框打架 */
.zone-headrow, .zone-row {
  display: grid;
  grid-template-columns: 88px minmax(140px, 1.5fr) 88px 96px minmax(118px, 172px) auto;
  gap: 10px;
  align-items: center;
}
.zone-headrow {
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--on-surface-variant);
  white-space: nowrap;
}
.zone-row { padding: 16px 0; }
.zone-row + .zone-row { border-top: 1px dashed var(--line); }
.zone-row .input { height: 38px; font-size: 13px; width: 100%; min-width: 0; }
.btn-layer { white-space: nowrap; }
.rows { overflow-x: auto; padding-bottom: 2px; }

.btn-layer {
  height: 32px;
  font-size: 12px;
  padding: 0 8px;
  color: var(--on-surface-variant);
  border-style: dashed;
}
.btn-layer.has { border-style: solid; border-color: var(--tint-blue-line); background: var(--primary-soft); color: var(--on-primary-container); }
.btn-layer.has:hover { border-color: var(--tint-blue-line-strong); background: var(--primary-container); }

.zone-preview {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 0 0 12px;
}
.zone-preview .pv {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--on-surface-variant);
}
.zone-preview .pv i { font-style: normal; color: var(--primary); font-weight: 600; }
.zone-preview .pv em {
  font-style: normal;
  font-family: var(--font);
  padding: 0 4px;
  border-radius: 3px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  font-size: 9.5px;
}
.zone-preview .pv.up { border-color: var(--tint-blue-line); background: var(--tint-2); color: var(--tint-mid-ink); }
.zone-preview .pv.more { font-family: var(--font); color: var(--on-surface-variant); background: transparent; border-style: dashed; }

/* ---- 层位抽屉 */
.level-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--on-surface-variant);
}
.level-legend b { color: var(--on-surface); font-weight: 600; margin-right: 3px; }

.level-grid { display: grid; gap: 6px; }

.level-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.level-cell:hover { border-color: var(--tint-blue-line-strong); box-shadow: var(--shadow-1); }
.level-cell.on { border-color: var(--tint-blue-line); background: var(--tint-2); }

.lc-top { display: flex; align-items: center; gap: 6px; }
.level-cell b { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.lc-num { margin-left: auto; font-size: 10.5px; color: var(--on-surface-variant); }
.level-cell.on .lc-num { color: var(--primary); font-weight: 600; }

.lc-codes { display: flex; gap: 3px; flex-wrap: wrap; }
.lc-codes i {
  font-style: normal;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--surface-3);
  color: var(--on-surface-variant);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 15px;
}
.lc-codes i.is-up { background: var(--primary-container); color: var(--on-primary-container); }
.lc-codes i.is-mid { background: var(--tint-mid-bg); color: var(--tint-mid-ink); }

.lc-step { display: flex; align-items: center; gap: 4px; }
.lc-step button {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-1);
  color: var(--on-surface);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 130ms var(--ease), border-color 130ms var(--ease);
}
.lc-step button:hover:not(:disabled) { background: var(--primary-soft); border-color: var(--tint-blue-line); color: var(--on-primary-container); }
.lc-step button:disabled { opacity: 0.4; cursor: not-allowed; }
.level-quick { justify-content: flex-start; }

/* ==========================================================================
   备份 / 客户详情 / 排序
   ========================================================================== */

.bk-list { display: flex; flex-direction: column; }
.bk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.bk-row:last-child { border-bottom: none; }
.bk-row:hover .bk-title { color: var(--primary); }
.bk-main { flex: 1; min-width: 0; }
.bk-title { font-size: 13px; font-weight: 500; transition: color 130ms var(--ease); }
.bk-time, .bk-note { font-size: 11.5px; color: var(--on-surface-variant); }
.bk-sub { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; font-size: 11.5px; color: var(--on-surface-variant); }
.bk-size { font-family: var(--mono); font-size: 11.5px; color: var(--on-surface-variant); width: 70px; text-align: right; flex: none; }
.bk-act { display: flex; gap: 4px; flex: none; }

.cust-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.cust-name { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.cust-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: 12.5px; color: var(--on-surface-variant); }
.cust-meta span { display: inline-flex; gap: 4px; }
.cust-meta b { color: var(--on-surface); font-weight: 500; }
.cust-head .acts { margin-left: auto; display: flex; gap: 8px; }

.ord { display: flex; flex-direction: column; gap: 1px; }
.ord button {
  width: 22px;
  height: 13px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-1);
  color: var(--on-surface-variant);
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 130ms var(--ease);
}
.ord button:hover:not(:disabled) { background: var(--primary-soft); color: var(--on-primary-container); border-color: #cfe0fb; }
.ord button:active:not(:disabled) { transform: scale(0.96); }
.ord button:disabled { opacity: 0.35; cursor: not-allowed; }

/* 主题图标 */
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline-flex; }

@media print {
  .appbar, .navdrawer, .head-actions, .toolbar, .row-actions, .fab { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; border-color: #ddd; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 零散补充 */
.uploader.wide { align-items: flex-start; }
.uploader.wide .preview { width: 72px; height: 72px; }
.cell.lv-m4 .lv, .cell.lv-m5 .lv { background: var(--tint-mid-bg); color: var(--tint-mid-ink); }
.mono-num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   定位弹层：一个编号散在好几个区时，先列出来再选
   ========================================================================== */

.locate { display: flex; flex-direction: column; gap: 14px; }

.locate-state {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--tint-blue-line);
  border-radius: var(--r-md);
  background: var(--primary-soft);
}
.locate-state .ico {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--surface-1);
  color: var(--primary);
}
.locate-state b { font-size: 13px; display: block; }
.locate-state .sub { font-size: 11.5px; color: var(--on-surface-variant); line-height: 1.55; margin-top: 2px; }
.locate-state b.mono { display: inline; }
.locate-state.is-empty { border-color: var(--line-strong); background: var(--surface-2); }
.locate-state.is-empty .ico { color: var(--on-surface-variant); }
.locate-state.is-neg { border-color: var(--tint-red-line); background: var(--tint-red-bg); }
.locate-state.is-neg .ico { color: var(--error); }

.locate-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.lc-code { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.lc-sub { font-size: 11.5px; color: var(--on-surface-variant); margin-top: 2px; }
.locate-kpis {
  margin-left: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(50px, auto));
  gap: 12px;
  text-align: right;
}
.locate-kpis .k { display: block; font-size: 10.5px; color: var(--on-surface-variant); }
.locate-kpis b { font-size: 13px; font-variant-numeric: tabular-nums; }

.locate-age {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  font-size: 11.5px;
  color: var(--on-surface-variant);
}
.locate-age b { color: var(--on-surface); font-size: 12px; }
.locate-age.is-warm { border-color: var(--tint-amber-line); background: var(--warn-bg); color: var(--warn-ink); }
.locate-age.is-warm b { color: var(--warn-ink); }
.locate-age.is-old { border-color: var(--tint-red-line); background: var(--tint-red-bg); color: var(--on-error-container); }
.locate-age.is-old b { color: var(--on-error-container); }

.locate-sec > h4 {
  display: flex; align-items: baseline; gap: 6px;
  margin: 0 0 7px;
  font-size: 12px; font-weight: 600;
}
.locate-sec > h4 .muted { font-weight: 400; font-size: 11px; }

.locate-row {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.locate-row:last-child { margin-bottom: 0; }
.locate-row:hover { border-color: var(--tint-blue-line-strong); background: var(--tint-1); }
.locate-row.is-empty { background: var(--surface); }
.locate-row.is-empty:hover { background: var(--surface-2); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lr-code { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.lr-code .badge { font-size: 9.5px; padding: 0 5px; height: 15px; line-height: 15px; }
.lr-sub {
  font-size: 11px; color: var(--on-surface-variant);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lr-nums { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.lr-nums .q { font-family: var(--mono); font-weight: 650; font-size: 12.5px; }
.lr-nums .q.zero { font-weight: 400; color: var(--on-surface-variant); }
.lr-flow { font-size: 10.5px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.locate-idle {
  margin-top: 2px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  line-height: 15px;
  color: var(--on-surface-variant);
  white-space: nowrap;
}
.locate-idle.is-warm { border-color: var(--tint-amber-line); background: var(--warn-bg); color: var(--warn-ink); }
.locate-idle.is-old { border-color: var(--tint-red-line); background: var(--tint-red-bg); color: var(--on-error-container); }
.lr-go { flex: none; color: var(--on-surface-variant); display: grid; place-items: center; }
.locate-row:hover .lr-go { color: var(--primary); }
.locate-none { padding: 12px 0; font-size: 12px; color: var(--on-surface-variant); }

.locate-lots { display: flex; flex-wrap: wrap; gap: 6px; }
.lot {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-1);
  font-size: 11px;
}
.lot b { font-weight: 500; }
.lot span { color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.lot i { font-style: normal; font-size: 10.5px; color: var(--on-surface-variant); }
.lot.is-warm { border-color: var(--tint-amber-line); background: var(--warn-bg); }
.lot.is-old { border-color: var(--tint-red-line); background: var(--tint-red-bg); }

.locate-move {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--outline-variant);
  font-size: 11.5px;
}
.locate-move:last-child { border-bottom: none; }
.locate-move .d { flex: none; color: var(--on-surface-variant); }
.locate-move .badge { flex: none; }
.locate-move .loc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locate-move .amt { margin-left: auto; flex: none; font-family: var(--mono); font-weight: 600; }
.locate-move .party {
  flex: 0 1 30%;
  min-width: 0;
  text-align: right;
  font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ==========================================================================
   旧库存
   ========================================================================== */

.age-pill {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--on-surface-variant);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.age-pill.is-soft { border-color: var(--line-strong); color: var(--on-surface); }
.age-pill.is-warm { border-color: var(--tint-amber-line); background: var(--warn-bg); color: var(--warn-ink); font-weight: 550; }
.age-pill.is-old { border-color: var(--tint-red-line); background: var(--tint-red-bg); color: var(--on-error-container); font-weight: 600; }

.aging-toolbar { margin-bottom: 12px; }
.aging-stats { margin-bottom: 0; }
.aging-mini { display: flex; gap: 22px; padding: 2px 0 0; }
.aging-mini > div { display: flex; flex-direction: column; }
.aging-mini b { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.aging-mini span { font-size: 11px; color: var(--on-surface-variant); }

/* ==========================================================================
   公告栏：顶栏按钮（查找按钮左边）+ 屏幕中间的竖向长方形面板。
   开合动画只走 transform/opacity，合成器直出不卡页面。
   z-index 89：盖过页面内容（≤70），压在抽屉/确认弹窗（90-92）、菜单(95)之下——
   这样面板里点「发布」拉出的抽屉、删除确认框都能正常盖在公告面板上面。
   ========================================================================== */

.anno {
  position: fixed;
  inset: 0;
  z-index: 89;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
}
.anno[hidden] { display: none !important; }

/* 背景压暗层：点它 = 关闭 */
.anno-veil {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.anno.open .anno-veil { opacity: 1; pointer-events: auto; }
.anno.closing .anno-veil { opacity: 0; pointer-events: none; }

/* 竖向长方形面板：宽 440、高随内容（上限 80vh），列表超高时内部滚动 */
.anno-panel {
  pointer-events: auto;
  position: relative;
  width: min(440px, 100%);
  max-height: min(80vh, 680px);
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(9, 12, 18, 0.28);
  overflow: hidden;
}
.anno.open .anno-panel { animation: annoPopIn .2s var(--ease); }
.anno.closing .anno-panel { animation: annoPopOut .18s ease forwards; }
@keyframes annoPopIn {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: none; }
}
@keyframes annoPopOut {
  to { opacity: 0; transform: translateY(6px) scale(.96); }
}

.anno-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.anno-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.anno-head-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.anno-head-main b { font-size: 15px; }
.anno-sub { font-size: 11.5px; color: var(--on-surface-variant); }
.anno-tools { display: flex; align-items: center; gap: 6px; }
.anno-tools .icon-btn { width: 28px; height: 28px; }
.anno-admin {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 12px 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--on-surface-variant);
}
.anno-admin[hidden] { display: none; }
.anno-admin > span { flex: 1; min-width: 0; }

/* 公告列表：竖向单列 */
.anno-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
}

.anno-item {
  padding: 10px 12px 11px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--r-md);
  background: var(--surface-1);
}
.anno-item.lvl-info { border-left-color: var(--primary); }
.anno-item.lvl-warn { border-left-color: var(--tertiary); }
.anno-item.lvl-urgent { border-left-color: var(--error); }
.anno-item.is-pinned { background: var(--tint-1); }
.anno-item.is-off { opacity: 0.55; }

.anno-item-head { display: flex; align-items: center; gap: 6px; }
.anno-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--primary); }
.lvl-warn .anno-dot { background: var(--tertiary); }
.lvl-urgent .anno-dot { background: var(--error); }
.anno-title {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.anno-time { flex: none; font-size: 10.5px; color: var(--on-surface-variant); }
.anno-flag {
  flex: none;
  padding: 0 5px; height: 15px; line-height: 15px;
  border-radius: 4px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-size: 10px; font-style: normal;
}
.anno-flag.is-off { background: var(--surface-3); color: var(--on-surface-variant); }
.anno-body {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--on-surface);
  word-break: break-word;
}
.anno-body.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.anno-more {
  margin-top: 3px; padding: 0;
  border: none; background: none;
  color: var(--primary);
  font: inherit; font-size: 11px;
  cursor: pointer;
}
.anno-by { margin-top: 5px; font-size: 10.5px; color: var(--on-surface-variant); }
.anno-foot {
  padding: 9px 12px 11px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--on-surface-variant);
  text-align: center;
}
.anno-empty {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 24px 12px;
  color: var(--on-surface-variant);
  font-size: 12px;
  text-align: center;
}
.anno-empty b { font-size: 13px; color: var(--on-surface); }
.anno-empty svg { opacity: 0.6; }

/* 顶栏入口：查找按钮左边的公告按钮 + 未读角标 */
.anno-slot { position: relative; display: inline-flex; }
.anno-slot[hidden] { display: none; }
.anno-btn.is-off { opacity: 0.72; }
.anno-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--error);
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  font-style: normal;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.anno-badge[hidden] { display: none; }

.anno-editor .field + .field { margin-top: 12px; }
.anno-editor-row { display: flex; align-items: center; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.anno-editor-row .field { flex: 0 0 150px; }
.anno-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.anno-check input { width: 15px; height: 15px; accent-color: var(--primary); }

@media (max-width: 720px) {
  .anno { padding: 14px; }
  .anno-panel { width: 100%; max-height: min(84vh, 620px); border-radius: 14px; }
  .locate-kpis { width: 100%; margin-left: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); text-align: left; }
  .locate-move { flex-wrap: wrap; }
  .locate-move .party { flex: 1 1 100%; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .anno-panel, .anno-veil {
    animation: none !important;
    transition: none !important;
  }
}


@media (max-width: 720px) {
  .locate-kpis { width: 100%; margin-left: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); text-align: left; }
  .locate-move { flex-wrap: wrap; }
  .locate-move .party { flex: 1 1 100%; text-align: left; }
}

/* 记录列表里贴着库位的小图钉：不用横向滚到最右也能定位 */
.loc-cell { display: inline-flex; align-items: center; gap: 3px; }
.loc-pin {
  width: 18px; height: 18px; flex: none;
  display: grid; place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.loc-pin:hover { border-color: var(--tint-blue-line); background: var(--primary-soft); color: var(--primary); }


.locate-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--tint-amber-line);
  border-radius: var(--r-md);
  background: var(--warn-bg);
  font-size: 11px;
  line-height: 1.55;
  color: var(--warn-ink);
}
.locate-hint > span { flex: 1; min-width: 0; }
.locate-hint .btn { flex: none; background: var(--surface-1); border-color: var(--tint-amber-line); color: var(--warn-ink); }

/* ================================================================ 全量备份包 */

.appbar-logo img { width: 17px; height: 17px; object-fit: contain; display: block; }

.pkg-stats {
  display: grid;
  /* minmax(0, 1fr) 而不是 1fr：1fr 的下限是内容的 min-content，
     「图片 · 12.3 MB」撑不下时整行会顶出卡片，被 overflow 裁掉一截 */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.pkg-kpi {
  background: var(--surface-1);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
/* 以前这里 b/span 都是 nowrap + ellipsis，卡片窄一点
   「图片 · 1.2 MB」就变成「图片 · 1.2…」，看着像数字没显示全。
   现在允许折行，实在很长就换行显示，完整信息永远看得见。 */
.pkg-kpi b {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.pkg-kpi span {
  font-size: 11px;
  line-height: 1.4;
  color: var(--on-surface-variant);
  overflow-wrap: anywhere;
}

.pkg-progress { padding: 14px 16px 4px; }
.pkg-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.pkg-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary);
  transition: width .25s ease;
}
.pkg-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-top: 7px;
}
.pkg-label b { color: var(--on-surface); font-variant-numeric: tabular-nums; }

.pkg-list { padding: 4px 0; }
.pkg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.pkg-row:last-child { border-bottom: 0; }
.pkg-main { min-width: 0; flex: 1; }
.pkg-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 560;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pkg-sub {
  font-size: 11.5px;
  color: var(--on-surface-variant);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pkg-size { font-size: 12px; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.pkg-act { display: flex; gap: 6px; flex: none; }
.pkg-check { font-size: 12.5px; line-height: 1.75; }

@media (max-width: 720px) {
  .pkg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pkg-row { flex-wrap: wrap; }
  .pkg-act { width: 100%; justify-content: flex-end; }
  /* 手机上一行放不下「产品 0 · 入库 0 · 出库 0 · 图片 0 · 视频 0」，让它换行而不是省略号 */
  .pkg-sub { white-space: normal; overflow: visible; }
}

/* ================================================================ 网站设置 */

.logo-row { display: flex; gap: 22px; flex-wrap: wrap; }
.logo-box { display: flex; flex-direction: column; align-items: flex-start; }
.logo-prev {
  width: 84px;
  height: 84px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.logo-prev.is-fav { width: 56px; height: 56px; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-fallback { color: var(--on-surface-variant); font-size: 24px; }
.logo-cap { font-size: 11.5px; color: var(--on-surface-variant); margin-top: 6px; }

.site-preview { display: flex; flex-direction: column; gap: 8px; }
.site-prev-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.site-prev-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--primary-container);
  color: var(--on-primary-container);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}
.site-prev-logo img { width: 18px; height: 18px; object-fit: contain; }
.site-prev-bar b { display: block; font-size: 14px; font-weight: 600; }
.site-prev-bar i {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--on-surface-variant);
}
.site-prev-hint { font-size: 11px; color: var(--on-surface-variant); }

/* ================================================================ 出入库明细导出 */
.mv-range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mv-range label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--on-surface-variant); }
.mv-range input[type="date"] {
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-1);
  color: var(--on-surface); padding: 7px 10px; font: inherit; font-size: 13px;
}

/* 对账导出 · 手机端适配 */
@media (max-width: 720px) {
  .mv-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .mv-range label { flex-direction: column; align-items: stretch; gap: 4px; }
  .mv-range label input[type="date"] { width: 100%; }
  .mv-range .btn { justify-content: center; }
  .mv-m-head { flex-direction: column; align-items: stretch; gap: 6px; }
  .mv-m-head .hint { flex: none; width: 100%; }
  .mv-m-head .btn { align-self: flex-start; }
  .mv-m-row { flex-wrap: wrap; gap: 8px; }
  .mv-m-row .mono { flex: 1 1 100%; white-space: normal; }
  .mv-m-row .hint { flex: 1; }
}
/* 通用小屏：卡片头部按钮换行、页面动作区右对齐改纵向 */
@media (max-width: 720px) {
  .page-head .actions { width: 100%; }
  .card-head .right { width: 100%; justify-content: flex-start; margin-top: 8px; }
}

/* 手机端：搜索框占满一行，placeholder 完整可见 */
@media (max-width: 720px) {
  .search { flex: 1 1 100%; max-width: none; min-width: 0; }
  .toolbar .seg { width: 100%; overflow-x: auto; }
}

/* 表格顶部同步横向滚动条：宽表不用拖到最底下 */
.hscroll-proxy {
  overflow-x: auto;
  height: 14px;
  margin-bottom: 6px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.hscroll-proxy::-webkit-scrollbar { height: 12px; }
.hscroll-proxy::-webkit-scrollbar-thumb {
  background: var(--line-strong, #b9c4d4);
  border-radius: 999px;
}
.hscroll-proxy::-webkit-scrollbar-track { background: transparent; }

/* 手机端：仓库布局编辑器两列卡片式，不再横向挤压 */
@media (max-width: 720px) {
  .zone-headrow { display: none; }
  .zone-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 0;
  }
  .zone-row .input { width: 100%; }
  .zone-row .btn-layer { justify-content: center; }
  .zone-preview { margin-top: 2px; }
}


/* 分区行的唯一徽章：列宽自适应 + 单行完整显示，不再挤压重叠 */
.zone-row .badge, .zone-headrow .badge {
  white-space: nowrap;
  justify-self: end;
  flex: none;
}

/* 日历式日期选择器（createDatePicker）：与月份弹层同一套风格 */
.pp-cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.pp-cal-head span {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--on-surface-variant);
}
.pp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.pp-day {
  height: 28px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--on-surface);
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}
.pp-day:hover { background: var(--primary-soft); color: var(--on-primary-container); }
.pp-day.pad { visibility: hidden; }
.pp-day.on { background: var(--primary); color: var(--on-primary); font-weight: 500; }
.pp-day.is-now { box-shadow: inset 0 0 0 1px var(--tint-blue-line); }

/* 休 / 班标记：法定节假日红色「休」，调休上班日蓝色「班」（国务院官方安排） */
.pp-day { position: relative; }
.pp-day .pp-tag {
  position: absolute;
  top: 1px;
  right: 1px;
  font-size: 8px;
  line-height: 1;
  font-style: normal;
  font-weight: 600;
  border-radius: 3px;
  padding: 1.5px 2px;
  pointer-events: none;
}
.pp-tag.is-hol { color: #dc2626; background: rgba(220, 38, 38, 0.1); }
.pp-tag.is-work { color: #2563eb; background: rgba(37, 99, 235, 0.1); }
.pp-day.is-hol-day { color: #dc2626; }
.pp-day.is-work-day { color: #2563eb; }
.pp-day.is-weekend { color: var(--on-surface-variant); }
.pp-day.on.is-hol-day, .pp-day.on.is-work-day, .pp-day.on.is-weekend { color: var(--on-primary); }
.pp-day.on .pp-tag { color: var(--on-primary); background: transparent; }
.pp-day.is-hol-day:hover, .pp-day.is-work-day:hover, .pp-day.is-weekend:hover { color: var(--on-primary-container); }

/* 表单里的日期控件：输入框 + 右侧日历按钮（弹层复用 .period-pop） */
.day-field { position: relative; display: flex; align-items: center; }
.day-field .input { flex: 1 1 auto; min-width: 0; padding-right: 34px; font-variant-numeric: tabular-nums; }
.day-field.open .input { border-color: var(--tint-blue-line); background: var(--primary-soft); }
.day-btn {
  position: absolute;
  right: 4px;
  width: 27px;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.day-btn:hover { background: var(--surface-2); color: var(--on-surface); }
.day-btn:disabled { opacity: .45; cursor: default; }
.day-pop { width: 252px; }
.pp-legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--on-surface-variant);
  margin-right: auto;
}
.pp-legend .pp-tag { position: static; }
.p-label.ph { color: var(--on-surface-variant); font-weight: 400; }

/* 可排序列：表头可点，当前列显示箭头 */
th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.th-sort:hover { color: var(--primary); }
th.th-sort .th-sort-arrow {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  color: var(--primary);
  transform: translateY(1px);
}
th.th-sort.num .th-sort-arrow { margin-left: 3px; margin-right: -1px; }

/* 选项徽标：出入库类型等下拉选项的全站统一显示（自定义颜色走内联样式） */
.opt-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.7;
  white-space: nowrap;
  background: var(--surface-2);
}
.opt-chip.is-soft { opacity: .82; }

/* 字段设置：下拉选项逐项编辑器 */
.opt-editor { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.opt-row { display: flex; align-items: center; gap: 6px; }
.opt-row .opt-color {
  width: 30px; height: 30px; padding: 2px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); cursor: pointer; flex: 0 0 auto;
}
.opt-row .input { flex: 1 1 auto; min-width: 0; }
.opt-row .btn-icon { flex: 0 0 auto; }

/* 对账导出的开始 → 结束分隔符 */
.mv-sep { color: var(--on-surface-variant); font-size: 13px; }

/* 批量导入出入库：错误逐行列出 */
.import-errs { font-size: 12.5px; line-height: 1.55; }
.import-errs > b { display: block; margin-bottom: 8px; color: var(--error); }
.import-errs .err-list {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 8px;
}
.import-errs .err-row {
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.import-errs .err-row:last-child { border-bottom: none; }
.import-errs .err-row .mono { color: var(--on-surface-variant); flex: 0 0 auto; }

/* ================================================================ 概览：今日动态条 / 警示条 */
.today-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 10px;
  margin-bottom: 14px;
}
.today-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--on-surface);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), transform 150ms var(--ease);
}
.today-cell:hover { border-color: var(--tint-blue-line); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.today-cell:active { transform: none; }
.today-cell .k { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--on-surface-variant); }
.today-cell .v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.today-cell .v small { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); margin-left: 3px; }
.today-cell .meta { font-size: 11px; color: var(--on-surface-variant); }
.today-cell.out .v { color: var(--error); }
.today-cell.trend .v { font-size: inherit; font-weight: inherit; }
.trend-mini { display: flex; align-items: flex-end; gap: 6px; height: 30px; margin: 2px 0; }
.tg { display: inline-flex; align-items: flex-end; gap: 2px; }
.tg .ti, .tg .to { display: inline-block; width: 7px; border-radius: 3px 3px 0 0; }
.tg .ti { background: var(--primary); }
.tg .to { background: #d97706; }

.warn-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border: 1px solid #f0c36d;
  border-radius: var(--r-lg);
  background: #fff8e6;
  color: #7c4a03;
  font-size: 13px;
  cursor: pointer;
}
.warn-strip span { flex: 1; color: #92610e; }
.warn-strip svg:last-child { color: #b98a2f; }

@media (max-width: 720px) {
  .today-strip { grid-template-columns: 1fr; }
  .today-cell { flex-direction: row; align-items: center; gap: 10px; }
  .today-cell .v { margin-left: auto; font-size: 18px; }
  .today-cell.trend { flex-wrap: wrap; }
  .trend-mini { margin-left: 0; }
}


/* ================================================================ 登录页入场动画 */
@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.auth-side .auth-brand { animation: authFadeUp .5s var(--ease) backwards; }
.auth-side .auth-hero .anim { animation: authFadeUp .55s var(--ease) backwards; }
.auth-side .auth-hero .a1 { animation-delay: .06s; }
.auth-side .auth-hero .a2 { animation-delay: .14s; }
.auth-side .auth-hero .a3 { animation-delay: .24s; }
.auth-side .auth-hero .a4 { animation-delay: .30s; }
.auth-side .auth-hero .a5 { animation-delay: .36s; }
.auth-side .auth-hero .a6 { animation-delay: .42s; }
.auth-side > div:last-child { animation: authFadeUp .5s var(--ease) .5s backwards; }
.auth-main .anim.auth-card { animation: authFadeUp .5s var(--ease) .12s backwards; }
@media (prefers-reduced-motion: reduce) {
  .auth-side *, .auth-main .anim.auth-card { animation: none !important; }
}

/* ================================================================ 明暗切换过渡 */
/* 切换瞬间由 JS 挂 .theme-switching，650ms 后自动摘除；平时不挂，零性能负担。
   这里必须「禁用」过渡而不是给全页挂过渡：给几万个节点（大表格尤其多）同时挂
   颜色过渡会让它们各自跑一遍 400ms 动画，主线程直接卡死——禁用后所有颜色变化
   在一次重绘里瞬间完成，快且干脆。 */
.theme-switching, .theme-switching *, .theme-switching *::before, .theme-switching *::after {
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .theme-switching, .theme-switching *, .theme-switching *::before, .theme-switching *::after {
    transition: none !important;
  }
}

/* ================================================================ 文本+媒体混合字段 */
.media-field.is-mixed { display: flex; flex-direction: column; gap: 8px; }
.media-field.is-mixed .input { margin-bottom: 2px; }
.cell-2l { display: inline-flex; flex-direction: column; gap: 4px; vertical-align: middle; }


/* ==========================================================================
   批量选择删除（购物车式，仅超级管理员可见）
   ========================================================================== */

/* 表格里的选择列：复选框列 + 数据首列一起吸附左侧 */
td.sel-col, th.sel-col {
  width: 36px;
  min-width: 36px;
  text-align: center;
  padding: 0 4px;
}
td.sel-col input, th.sel-col input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  vertical-align: middle;
}
/* 选择模式下整行可点：hover 给个提示，点行任意位置都是勾选 */
.table-wrap tbody tr:has(td.sel-col input) { cursor: pointer; }
.table-wrap tbody tr:has(td.sel-col input):hover td { background: var(--tint-2); }
tr:has(td.sel-col input:checked) td { background: var(--tint-2); }

/* 底部结算浮条：选了行才浮出来 */
.batch-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 85;   /* 压过页面内容，低于抽屉(91) / 公告面板(89) / 弹窗 */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-1);
  box-shadow: 0 14px 34px rgba(9, 12, 18, 0.26);
  animation: batchBarIn .18s var(--ease);
}
.batch-bar[hidden] { display: none; }
.batch-count { font-size: 12.5px; color: var(--on-surface); white-space: nowrap; }
.batch-count b { color: var(--primary); font-size: 14px; }
@keyframes batchBarIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .batch-bar { animation: none; }
}


/* ==========================================================================
   多库位分配（入库 / 出库登记：一条记录把数量划给多个库位）
   ========================================================================== */
.mlf-rows { display: flex; flex-direction: column; gap: 8px; }
/* 库位分配行：字段独占一栏（span-2）后库位选择占满剩余宽度，
   数量框 132px 保证六七位数也完整显示不遮挡 */
.mlf-row { display: grid; grid-template-columns: minmax(0, 1fr) 132px auto; gap: 8px; align-items: center; }
.mlf-row .combo-field { margin: 0; }
.mlf-row .mlf-qty {
  height: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 550;
}
.mlf-row .combo-wrap, .mlf-row .combo-code { width: 100%; }
.mlf-rm { color: var(--on-surface-variant); }
.mlf-rm:hover { color: var(--error); }
.mlf-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.mlf-sum { font-size: 12.5px; color: var(--on-surface-variant); white-space: nowrap; }
.mlf-sum b { color: var(--primary); font-variant-numeric: tabular-nums; }
.mlf-sum i, .mlf-sum .mlf-warn { font-style: normal; color: var(--tertiary); }
.mlf-sum .mlf-warn { color: var(--error); }

/* 列表位置列的多库位徽标：A1-U +2 */
.loc-plus {
  padding: 0 5px; height: 16px; line-height: 16px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px; font-weight: 600; font-style: normal;
  white-space: nowrap;
}
