/* ========== 仓库管理系统 - 现代视觉 ==========
   分区索引（按文件中出现顺序，便于定位）：
      1. 侧边栏布局（参考 DBERP：左菜单 + 右内容全宽）
      2. 卡片
      3. 标题
      4. Flash 消息
      5. 表格（紧凑密度，一屏更多行）
      6. 表单
      7. 按钮
      8. 徽章（胶囊）
      9. 统计卡片
     10. 表单布局
     11. 应急物资页：用途分布彩色胶囊标签
     12. 模态弹窗（资产编辑等）
     13. 固定资产开关（入库明细行）
     14. 登录页（全屏渐变 + 居中卡片 + 装饰光晕）
     15. 响应式
     16. 移动端（手机）：汉堡菜单 + 抽屉导航
     17. 多栏布局（减少垂直堆叠，提升信息密度）
     18. 页面标题区（主流：大标题 + 描述 + 右侧操作）
     19. 顶栏：白底吸顶 + 细边框
     20. 侧边栏：白底 + 圆角菜单项 + 激活态主色浅底
     21. 卡片
     22. 表格（主流紧凑风）
     23. 按钮
     24. 表单
   ※ 层叠顺序敏感：新增样式请追加到文件末尾（不要插到中间），避免覆盖关系变化。
*/
/* ---------- CSS 变量（色板）说明 ----------
   --primary / --primary-dark / --primary-light：品牌主色（靛蓝紫）及其加深/浅底变体，
       用于主按钮、链接、选中态、hover 底色（--primary-light 常作浅色强调背景）；
   --bg：页面底色（浅灰紫）；--card：卡片/面板底色（纯白）；--text：正文色；--muted：次要文字色；
   --danger / --success / --warn：语义色（红/绿/橙），分别用于低库存警示、正常/成功、预警提示；
   --border：边框/分隔线色；--radius：统一圆角（卡片/按钮/输入框共用）；
   --shadow-sm / --shadow / --shadow-lg：三级阴影层级（常态/卡片悬浮/浮层下拉）。
   全站颜色与阴影均引用这些变量，改主题只需调整 :root 中的取值。 */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 34px rgba(15, 23, 42, .12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}
::selection { background: rgba(79, 70, 229, .18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- 侧边栏布局（参考 DBERP：左菜单 + 右内容全宽） ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 212px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid rgba(226, 232, 240, .9);
  display: flex; flex-direction: column;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 16px 14px;
  font-weight: 800; font-size: 15px; letter-spacing: .2px;
  background: var(--primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sidenav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidenav a, .sidenav .dropdown-toggle {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  padding: 10px 14px; border-radius: 12px;
  text-decoration: none; color: var(--text);
  font-size: 14px; font-family: inherit; background: none; border: none; cursor: pointer;
  transition: background .15s, color .15s;
}
.sidenav .ic { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.sidenav a:hover, .sidenav .dropdown-toggle:hover { background: var(--primary-light); color: var(--primary); }
.sidebar-user {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden;
}
.sidebar-user .tx { flex: 1; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sidebar-user .btn { margin-left: auto; flex-shrink: 0; }

/* 内容区：全宽自适应 */
.content { flex: 1; min-width: 0; padding: 26px 30px 40px; width: 100%; }
@media (min-width: 1600px) { .content { padding: 30px 40px 48px; } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, .85);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  overflow-x: auto; /* 内容超宽时卡片内滚动，不撑破布局 */
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }

/* 卡片标题栏（系统配置等分区块用）：浅色底 + 下分隔线 */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg);
  margin: -22px -22px 16px;
  padding: 13px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid rgba(226, 232, 240, .9);
}
.card-head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }

/* 文件转换：目标模板卡片选择 */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tpl-card { cursor: pointer; display: block; }
.tpl-card input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-inner {
  border: 2px solid rgba(226, 232, 240, .9);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.tpl-card:hover .tpl-inner { border-color: var(--primary); }
.tpl-card input:checked + .tpl-inner {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-sm);
}
.tpl-name { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.tpl-name .ic { margin-right: 6px; }
.tpl-cols { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 文件转换：上传拖放区 */
.upload-box {
  border: 2px dashed rgba(148, 163, 184, .6);
  border-radius: 12px;
  padding: 22px 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color .15s ease, background .15s ease;
}
.upload-box:hover { border-color: var(--primary); background: #f0f7ff; }
.upload-ic { font-size: 30px; line-height: 1; }
.upload-title { font-size: 14px; font-weight: 600; }
.upload-hint { font-size: 12px; color: var(--muted); }
.upload-file { font-size: 13px; color: var(--primary); font-weight: 600; }

/* 系统配置：折叠操作按钮（新增/编辑/重命名/修改）统一样式 */
details.cfg > summary {
  display: inline-block;
  cursor: pointer;
  user-select: none;
  background: #eef2ff;
  color: #2563eb;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.7;
  transition: background .15s ease;
}
details.cfg > summary:hover { background: #e0e7ff; }
details.cfg > summary::marker { content: ''; }
details.cfg[open] > summary { background: #e0e7ff; }
details.cfg form, details.cfg table { margin-top: 10px; }
td details.cfg > summary { font-size: 12px; padding: 2px 9px; }

/* 表格单元格里 <details> 展开的编辑面板（用户管理/仓库管理/分类小类等）：
   默认行内展开时，面板宽度受限于所在「操作」列（约 100px），字段被挤成窄条。
   这里给面板明确的 width（不是 max-width —— 绝对定位元素的宽度会被包含块压缩，
   只写 max-width 不起作用，这正是之前改成窄条的原因），并右对齐向左展开，
   保证始终落在卡片内。手机窄屏用 min() 收窄，避免顶出视口。 */
td details:not(.rec-edit)[open] > *:not(summary) {
  position: absolute;
  top: calc(100% + 6px);
  left: auto;
  right: 0;
  z-index: 30;
  width: 420px;
  min-width: 0 !important;
  max-width: min(420px, calc(100vw - 40px));
  margin: 0;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line, #dde3ea);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(16, 24, 40, .14);
  white-space: normal;
}
td details:not(.rec-edit) { position: relative; }
/* 分类小类的编辑面板：小类表格在分类卡片（.cat-item）内且偏右，若沿用其他页面的
   420px 宽会横跨到相邻卡片上。这里收窄并右对齐到「编辑」按钮，使其落在本卡片内
   （实测卡片可用宽度约 328px：小类表格右缘到卡片左缘的距离，故取 316px 留余量）。 */
td details.cat-sub-edit[open] > *:not(summary) {
  width: 316px;
  max-width: min(316px, calc(100vw - 40px));
  right: 0;
  left: auto;
}
@media (max-width: 640px) {
  /* 手机：分类卡片内的表格列很窄，就地展开无论左右都会出屏。
     改为贴着屏幕底部的表单条（宽 = 视口 - 16px），字段照样完整可编辑。 */
  td details.cat-sub-edit[open] > *:not(summary) {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    top: auto;
    width: auto;
    max-width: none;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 60;
  }
}

td details:not(.rec-edit)[open] > *:not(summary) .form-row { margin-bottom: 10px; }
td details:not(.rec-edit)[open] > *:not(summary) label {
  display: block; text-align: left; font-size: 12.5px; margin: 0 0 4px;
}
td details:not(.rec-edit)[open] > *:not(summary) input,
td details:not(.rec-edit)[open] > *:not(summary) select { width: 100%; box-sizing: border-box; }
@media (max-width: 640px) {
  td details:not(.rec-edit)[open] > *:not(summary) {
    width: calc(100vw - 32px);
    right: -6px;
  }
}

/* ---------- 标题 ---------- */
h1 {
  font-size: 22px;
  margin-bottom: 18px;
  font-weight: 700;
  position: relative;
  padding-left: 14px;
  letter-spacing: .3px;
}
h1::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 5px; height: 24px;
  border-radius: 3px;
  background: var(--primary);
}
h2 { font-size: 16px; margin-bottom: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Flash 消息 ---------- */
.flash {
  padding: 11px 16px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid transparent;
  border-left-width: 4px;
  animation: slideIn .28s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.flash.success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; border-left-color: var(--success); }
.flash.error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; border-left-color: var(--danger); }
.flash.info { background: #eef2ff; color: var(--primary-dark); border-color: #c7d2fe; border-left-color: var(--primary); }

/* ---------- 表格（紧凑密度，一屏更多行） ---------- */
table { width: 100%; border-collapse: collapse; min-width: 0; }
.card > table, .card table { margin-top: 4px; }
td form.inline { display: inline-flex; flex-wrap: wrap; gap: 4px; }
th, td { padding: 10px 12px; text-align: center; border-bottom: 1px solid rgba(226, 232, 240, .7); }
th {
  color: #475569;
  font-weight: 600;
  font-size: 13px;
  background: #f8fafc;
  white-space: nowrap;
}

/* 全站数字醒目：数量/库存/金额列 */
td.num { font-weight: 700; font-size: 15px; color: #0f172a; font-variant-numeric: tabular-nums; }
td.money { font-weight: 700; font-size: 15px; color: #059669; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num.low, .num.low { color: #dc2626; }
td.num.zero { color: #f59e0b; }
table.tbl-center th, table.tbl-center td { text-align: center; }
table.tbl-center td.num { text-align: center; }
table.tbl-center td.num b { justify-content: center; }
tbody tr:nth-child(even) td { background: #fbfcfe; }
tbody tr:hover td { background: var(--primary-light); }
th, td { font-variant-numeric: tabular-nums; }
form.inline { display: inline; }

/* ---------- 表单 ---------- */
input, select, textarea {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #9ca3af; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }
.btn.small { padding: 5px 11px; font-size: 13px; box-shadow: none; }
.btn.gray { background: #f1f5f9; color: var(--text); box-shadow: none; }
.btn.gray:hover { background: #e2e8f0; filter: none; }
.btn.danger { background: #fee2e2; color: var(--danger); box-shadow: none; }
.btn.danger:hover { background: #fecaca; filter: none; }

/* ---------- 徽章（胶囊） ---------- */
.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);

  white-space: nowrap;
}
.badge.center { background: #dbeafe; color: var(--primary); }   /* 在用：蓝 */
.badge.team { background: #fef3c7; color: var(--warn); }
.badge.low { background: #fee2e2; color: var(--danger); }
.badge.ok { background: #dcfce7; color: var(--success); }       /* 在库：绿 */

/* ---------- 统计卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, .75);
  border-radius: 12px;
  padding: 18px 16px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
a.stat { display: block; text-decoration: none; color: inherit; }
a.stat .label { color: var(--primary); }
.stat .stat-icon { font-size: 24px; display: block; margin-bottom: 4px; filter: drop-shadow(0 2px 3px rgba(15,23,42,.12)); }
.stat .num { font-size: 26px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .num.green { color: #059669; }
.stat .num.red { color: #dc2626; }
.stat .num.amber { color: #d97706; }
.stat .label { font-size: 13px; color: #64748b; margin-top: 6px; font-weight: 500; }
/* 商品管理页美化 */
table.tbl-center th, table.tbl-center td { text-align: center; }
table.tbl-center td.num { text-align: center; }
table.tbl-center td.num b { justify-content: center; }
/* 应急物资页表格：所有单元格强制居中（含 .num 与长文本列） */
table.ec-table th, table.ec-table td { text-align: center !important; }
.dup-card {
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, .8);
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color .15s, background .15s;
}
.dup-card:hover { border-color: rgba(79, 70, 229, .4); background: #f5f8ff; }
.merge-form {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #f8fafc; border: 1px dashed rgba(148, 163, 184, .5);
  border-radius: 12px; padding: 10px 12px;
}
.prod-name { font-weight: 700; font-size: 14px; color: #1e293b; display: flex; align-items: center; justify-content: center; gap: 6px; }
.prod-name .p-ico { font-size: 16px; }
.prod-cat { font-size: 12px; color: #475569; background: #f1f5f9; border-radius: 8px; padding: 3px 8px; display: inline-block; white-space: nowrap; }
.prod-spec { font-size: 12px; color: #64748b; background: #eff6ff; border-radius: 8px; padding: 3px 8px; display: inline-block; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num b { font-weight: 700; }
tr.prod-row:hover { background: #f8fafc; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.pager .pg-info { font-size: 13px; color: #64748b; }
.pager .pg-size { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #64748b; }

/* 首页数据分析：条形图 */
.bar { display: flex; align-items: center; gap: 10px; margin: 7px 0; padding: 5px 8px; border-radius: 8px; transition: background .15s; }
.bar:hover { background: rgba(241, 245, 249, .7); }
.bar .bar-label { width: 110px; font-size: 13px; color: #64748b; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.bar .bar-track { flex: 1; height: 20px; background: repeating-linear-gradient(90deg, #f1f5f9 0 4px, #f8fafc 4px 8px); border-radius: 12px; overflow: hidden; position: relative; }
.bar .bar-fill { height: 100%; border-radius: 12px; background: linear-gradient(90deg, #38bdf8, #2563eb); min-width: 2px; transition: width .3s; box-shadow: inset 0 1px 1px rgba(255,255,255,.35); }
.bar .bar-fill.green { background: linear-gradient(90deg, #34d399, #059669); }
.bar .bar-fill.amber { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.bar .bar-fill.red { background: linear-gradient(90deg, #fb7185, #ef4444); }
.bar .bar-val { width: 96px; font-size: 13px; font-weight: 600; color: #1e293b; white-space: nowrap; }
.bar .bar-val small { color: #94a3b8; font-weight: 400; }
details.prod-card .prod-stock { font-size: 12px; color: var(--muted); }
/* 分页每页数量选择框 */
select.page-size {
  width: 84px;
  height: 36px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right 10px center;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
}
select.page-size:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ---------- 表单布局 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; align-items: end; }
/* 入库单信息：固定 4 列横向排列（窄屏自动降 2 列），label/控件统一对齐 */
.form-grid-inline { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.3fr; gap: 14px; align-items: end; }
.form-grid-inline .form-row { min-width: 0; }
/* 出库单信息：固定 5 列横向排列 */
.form-grid-wide { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr 1.2fr; gap: 14px; align-items: end; }
.form-grid-wide .form-row { min-width: 0; }
@media (max-width: 900px) {
  .form-grid-inline, .form-grid-wide { grid-template-columns: 1fr 1fr; }
}
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 13px; color: var(--muted); font-weight: 500; }
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.muted { color: var(--muted); font-size: 13px; }
details { margin-top: 8px; }
details summary { cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 500; }
details summary:hover { color: var(--primary-dark); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 出库/调拨明细行：当前库存列 */
.line-stock.low { color: var(--danger); font-weight: 700; }
/* 明细行数字输入框：最小宽度，防止多位数（10+）显示不全 */
#lines td input[type="number"] { min-width: 58px; }
@media (max-width: 768px) {
  /* 窄屏进一步压缩明细行输入框最小宽度，保证多位数不出格、行不横向溢出 */
  #lines td input[type="number"] { min-width: 54px; }
}
/* 可搜索商品下拉（拼音首字母匹配） */
.spec-pick { position: relative; }
.spec-pick /* 物资搜索下拉：必须用 position:fixed —— 出库明细表格外层是 .table-scroll
   （overflow-x:auto 会让另一轴的 overflow-y 也被计算成 auto），绝对定位的下拉
   一旦超出表格下边界就被裁掉（实测只露出 3px，看着像"搜索失效"）。
   fixed 定位不参与祖先裁剪，位置由 JS 按输入框坐标设置。 */
.spec-list {
  position: fixed;
  z-index: 60;
  background: #fff;
  border: 1px solid var(--border, #d8dee9);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 26, 36, .14);
  max-height: 260px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.spec-pick .spec-list li {
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spec-pick .spec-list li:hover { background: var(--primary-light); color: var(--primary); }

/* ---------- 应急物资页：用途分布彩色胶囊标签 ---------- */
/* 按用途 code 区分色系（--c 由模板内联传入），选中实心、未选中彩色描边 */
.em-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1;
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff);
  border: 1.5px solid var(--c); text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.em-chip b { font-size: 14px; }
.em-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.em-chip.active { color: #fff; background: var(--c); box-shadow: 0 2px 8px color-mix(in srgb, var(--c) 45%, transparent); }
.em-chip.gray { color: #64748b; background: #f1f5f9; border-color: #cbd5e1; }
.em-chip.gray:hover { border-color: #94a3b8; }

/* 首页最近动态平铺列表：每条动态一行，虚线分隔 */
.feed-item {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 9px 2px; border-bottom: 1px dashed var(--border, #e2e8f0);
  font-size: 14px;
}
.feed-item:last-child { border-bottom: none; }
/* 登录页底部元信息：版权 + 版本号，居中弱化 */
.login-meta { margin-top: 20px; text-align: center; border-top: 1px solid rgba(148, 163, 184, .25); padding-top: 14px; }
.login-meta p { margin: 3px 0; font-size: 12px; color: #94a3b8; letter-spacing: .5px; }
.login-meta .ver-tag { display: inline-block; font-family: "SF Mono", Consolas, monospace; font-size: 11px; background: rgba(99, 102, 241, .08); color: #6366f1; border: 1px solid rgba(99, 102, 241, .25); border-radius: 999px; padding: 2px 10px; transition: all .15s; }
.login-meta .ver-tag:hover { background: rgba(99, 102, 241, .16); transform: translateY(-1px); }
/* 侧边栏版本卡片：位于用户信息上方空白处，虚线边框小卡片 */
.sidebar-ver {
  margin-top: auto;               /* 推到菜单下方、用户上方 */
  margin-left: 12px; margin-right: 12px; margin-bottom: 10px;
  padding: 9px 12px;
  font-size: 11px; color: #64748b;
  background: rgba(99, 102, 241, .05);
  border: 1px dashed rgba(99, 102, 241, .25);
  border-radius: 12px;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: .3px;
}
.sidebar-ver .dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: var(--shadow); flex-shrink: 0; }
.sidebar-ver code { font-family: "SF Mono", Consolas, monospace; color: #6366f1; font-weight: 600; }
.sidebar-ver a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.sidebar-ver a:hover code { text-decoration: underline; }
.sidebar-ver .ver-label { color: #94a3b8; margin-right: auto; }
/* ===== 表格行操作列：紧凑文字按钮（按语义着色，白底描边） ===== */
.row-ops { display: flex; align-items: center; gap: 5px; height: 26px; line-height: 26px; white-space: nowrap; }
.row-ops > * { margin: 0; align-self: center; display: inline-flex; }
.op-text {
  display: inline-flex; align-items: center; justify-content: center;
  height: 26px; padding: 0 7px; border-radius: 8px;
  background: #fff; border: 1px solid #e2e8f0;
  font-size: 12px; line-height: 1; cursor: pointer; color: #475569;
  text-decoration: none; transition: all .12s; font-family: inherit;
}
.op-text:hover { background: rgba(99, 102, 241, .08); border-color: rgba(99, 102, 241, .4); color: #4f46e5; }
.op-text.warn { color: #b45309; border-color: rgba(245, 158, 11, .3); }
.op-text.warn:hover { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .5); }
.op-text.ok { color: #16a34a; border-color: rgba(22, 163, 74, .25); background: rgba(22, 163, 74, .05); cursor: default; }
.op-text.danger { color: #dc2626; border-color: rgba(220, 38, 38, .25); }
.op-text.danger:hover { background: rgba(220, 38, 38, .08); border-color: rgba(220, 38, 38, .5); }
/* ===== 业务记录操作列：横铺 + 行内折叠编辑 ===== */
.rec-ops {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; line-height: 26px; vertical-align: middle;
}
.rec-ops > * { margin: 0; align-self: center; }
.rec-ops a.op-text, .rec-ops > .op-text { display: inline-flex; }
details.rec-edit { display: inline-flex; align-items: center; position: relative; }
details.rec-edit summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; }
details.rec-edit summary::-webkit-details-marker { display: none; }
details.rec-edit[open] summary.op-text { background: rgba(99, 102, 241, .12); border-color: rgba(99, 102, 241, .45); color: #4f46e5; }
details.rec-edit form {
  position: absolute; right: 0; top: 32px; z-index: 40;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 14px; width: 340px;
}
details.rec-edit form .form-row { margin-bottom: 8px; }
details.rec-edit form label { font-size: 12px; }
@media (max-width: 640px) {
  details.rec-edit form { position: fixed; left: 12px; right: 12px; top: 12vh; width: auto; }
}
/* ===== 全站统一：语义文字色 + 浅底强调类（替代内联硬编码颜色） ===== */
.t-red { color: var(--danger); font-weight: 600; }
.t-orange { color: var(--warn); font-weight: 600; }
.t-green { color: var(--success); font-weight: 600; }
.t-blue { color: var(--primary); font-weight: 600; }
.t-gray { color: var(--muted); font-weight: 400; }
.hl-red { background: #fef2f2; }
.hl-gray { background: #f8fafc; }
.card.card-err { border-color: var(--danger); }
.in-banner { padding: 8px 12px; background: linear-gradient(90deg, #fef2f2, #fff7f0); border-left: 3px solid var(--danger); }
/* ---------- 模态弹窗（资产编辑等） ---------- */
/* 遮罩：fixed 全屏半透明，点击遮罩关闭；内容卡片居中 */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .45);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 12px; padding: 22px;
  width: 100%; max-width: 400px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

/* ---------- 固定资产开关（入库明细行） ---------- */
/* 滑块开关：勾选变品牌紫色 + 文字高亮，替代普通 checkbox */
.asset-switch {
  position: relative; display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none; vertical-align: middle;
}
.asset-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.asset-switch .sw {
  width: 34px; height: 20px; background: #cbd5e1; border-radius: 12px;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.asset-switch .sw::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: left .2s; box-shadow: var(--shadow-sm);
}
.asset-switch input:checked + .sw { background: var(--primary); }
.asset-switch input:checked + .sw::after { left: 16px; }
.asset-switch .sw-label { font-size: 11px; color: #94a3b8; transition: color .2s; }
.asset-switch input:checked ~ .sw-label { color: var(--primary); font-weight: 700; }

/* 资产信息子行：渐变浅紫背景 + 左侧装饰竖条 */
.asset-row td {
  background: var(--primary-light) !important;
  border-left: 3px solid var(--primary);
}

/* ---------- 登录页（全屏渐变 + 居中卡片 + 装饰光晕） ---------- */
.login-page {
  /* 全屏渐变容器：抵消 .content 的留白，占据整个视口 */
  min-height: 100vh;
  margin: -26px -30px -40px;
  display: flex; align-items: center; justify-content: center;
  background: #0e1721;
  position: relative; overflow: hidden;
  padding: 40px 20px;
}
/* 背景装饰：模糊光晕圆（纯装饰，不响应交互） */
.login-blob { position: absolute; border-radius: 50%; filter: blur(64px); opacity: .45; pointer-events: none; }
.login-blob.b1 { width: 430px; height: 430px; background: #818cf8; top: -130px; right: -90px; }
.login-blob.b2 { width: 370px; height: 370px; background: #c084fc; bottom: -110px; left: -70px; }

/* 登录卡片：白色圆角卡片，大阴影悬浮于渐变背景上 */
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 12px;
  padding: 36px 34px 26px;
  box-shadow: var(--shadow-lg);
  animation: slideIn .35s ease;
}
/* 品牌区：Logo 圆角方块 + 标题 + 副标题 */
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  background: var(--primary-light);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, .15);
}
.login-brand h1 { font-size: 20px; margin: 0; padding: 0; }
.login-brand h1::before { display: none; }  /* 去掉全局 h1 的左侧竖条装饰 */

/* 登录表单：纵向排列，输入框带图标前缀 */
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field { position: relative; }
.login-field .login-field-ic {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  font-size: 15px; opacity: .75; pointer-events: none;
}
.login-field input {
  width: 100%; padding: 12px 14px 12px 40px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 15px; background: #fafbfc;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
/* 登录按钮：品牌渐变，全宽 */
.login-btn {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: var(--primary);
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 4px;
  cursor: pointer; margin-top: 4px;
  box-shadow: var(--shadow-lg);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.login-btn:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.login-btn:active { transform: translateY(0); }

/* 移动端：抵消 .content 的不同留白，卡片略紧凑 */
@media (max-width: 768px) {
  .login-page { margin: -14px -12px -34px; padding: 24px 14px; }
  .login-card { padding: 28px 22px 20px; }
}

/* ---------- 响应式 ---------- */
/* 平板/窄屏（≤900px）：侧边栏收窄为 56px 图标条（文字隐藏），内容区同步压缩边距 */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sidebar .brand { padding: 16px 0; justify-content: center; }
  .sidenav { padding: 8px 6px; }
  .sidenav a, .sidenav .dropdown-toggle { justify-content: center; padding: 11px 0; }
  .sidenav .tx, .sidebar-user .tx, .sidebar .caret { display: none; }
  .sidebar-user { justify-content: center; padding: 12px 0; }
  .sidebar-user .btn { margin-left: 0; }
  .content { padding: 18px 14px 32px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .card { overflow-x: auto; }
}

/* ---------- 移动端（手机）：汉堡菜单 + 抽屉导航 ---------- */
/* 默认（桌面/平板）隐藏移动端顶栏与遮罩，仅 ≤768px 时显示 */
.topbar { display: none; }
.scrim { display: none; }

@media (max-width: 768px) {
  /* 顶部栏 */
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 30;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }
  /* 汉堡按钮：42px 方形触控目标（触控友好），点击唤起左侧抽屉 */
  .hamburger {
    width: 42px; height: 42px; flex-shrink: 0;
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    font-size: 19px; line-height: 1; cursor: pointer; color: var(--text);
    box-shadow: var(--shadow-sm);
  }
  .hamburger:active { background: var(--primary-light); }
  .topbar-title {
    flex: 1; min-width: 0;
    font-weight: 700; font-size: 15px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .topbar-user { font-size: 12px; color: var(--muted); white-space: nowrap; }

  /* 抽屉侧边栏 */
  .layout { display: block; } /* 移动端改为纵向堆叠（顶栏 + 内容），侧栏转为抽屉 */
  /* 抽屉侧边栏：固定定位盖在内容之上，默认整体移出屏幕左侧 */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
    width: 248px; height: 100vh; height: 100dvh; /* 100dvh 兼容移动端地址栏收起/展开时的视口高度变化 */
    transform: translateX(-100%); /* 默认藏在屏幕外，加 .open 时滑入 */
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); } /* 由顶部汉堡按钮 JS 切换 .open 类控制抽屉开合 */
  .sidebar .brand { justify-content: flex-start; padding: 18px 16px 14px; }
  .sidenav a, .sidenav .dropdown-toggle { justify-content: flex-start; padding: 11px 14px; }
  .sidenav .tx, .sidebar-user .tx { display: block; }
  .sidebar-user { justify-content: flex-start; padding: 12px 14px; }
  /* 半透明遮罩：盖住内容区（z-index 40 低于抽屉 50），点击遮罩可关闭抽屉 */
  .scrim.show {
    display: block;
    position: fixed; inset: 0; z-index: 40;
    background: rgba(15, 23, 42, .45);
  }

  /* 内容与卡片 */
  .content { padding: 14px 12px 34px; }
  .card { padding: 14px; border-radius: 12px; overflow-x: auto; }
  .card:hover { transform: none; }
  .card-head { margin: -14px -14px 12px; padding: 11px 14px; }
  h1 { font-size: 19px; margin-bottom: 14px; padding-left: 12px; }
  h1::before { height: 20px; }

  /* 表格：紧凑 + 横向滚动保留 */
  th, td { padding: 8px 9px; font-size: 13px; }
  th { font-size: 12.5px; }
  td.num, td.money { font-size: 14px; }

  /* 表单：单列 + 大触控目标 */
  .form-grid, .form-grid-inline, .form-grid-wide { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; padding: 11px 13px; } /* 16px 防止 iOS 聚焦缩放 */
  .btn { padding: 11px 18px; font-size: 15px; }
  .btn.small { padding: 8px 13px; font-size: 13px; }
  .toolbar { gap: 8px; }
  .toolbar .btn, .search-bar .btn { flex: 1; text-align: center; }
  .search-bar input { flex: 1; min-width: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 13px 10px 11px; }
  .stat .num { font-size: 21px; }
  .stat .stat-icon { font-size: 20px; }
  .bar .bar-label { width: 72px; font-size: 12px; }
  .bar .bar-val { width: 74px; font-size: 12px; }
  .pager { gap: 10px; }
  .flash { font-size: 13.5px; padding: 10px 13px; }
}

/* ---------- 多栏布局（减少垂直堆叠，提升信息密度） ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; margin-bottom: 22px; }
.grid-2 .card, .grid-3 .card { margin-bottom: 0; }
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-2 .card, .grid-3 .card { margin-bottom: 22px; }
}

/* ===== AI 助手浮窗（右下角聊天，按账号开启） ===== */
#ai-fab{position:fixed;right:22px;bottom:22px;width:52px;height:52px;border-radius: 50%;background:var(--primary);color:#fff;font-size:24px;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow: var(--shadow-lg);z-index:1200;transition:transform .15s}
#ai-fab:hover{transform:scale(1.08)}
#ai-panel{position:fixed;right:22px;bottom:86px;width:360px;max-width:calc(100vw - 28px);height:480px;max-height:calc(100vh - 120px);background:#fff;border-radius: 12px;box-shadow: var(--shadow-lg);display:none;flex-direction:column;overflow:hidden;z-index:1201}
#ai-panel.show{display:flex}
.ai-head{display:flex;align-items:center;gap:6px;padding:12px 14px;background:var(--primary);color:#fff;font-weight:600;font-size:14px}
#ai-body{flex:1;overflow-y:auto;padding:12px;background:#f8fafc;display:flex;flex-direction:column;gap:8px}
.ai-msg{max-width:86%;padding:9px 12px;border-radius: 12px;font-size:13.5px;line-height:1.6;white-space:pre-wrap;word-break:break-word}
.ai-msg.bot{background:#fff;border:1px solid #e2e8f0;align-self:flex-start;color:#334155}
.ai-msg.user{background:var(--primary);color:#fff;align-self:flex-end}
.ai-msg.err{background:#fef2f2;border-color:#fecaca;color:#dc2626}
.ai-card{align-self:flex-start;background:#fff;border:1px solid #e2e8f0;border-radius: 12px;padding:10px 12px;font-size:13px;max-width:92%}
.ai-card a{display:inline-block;margin-top:8px;background:#16a34a;color:#fff;padding:6px 14px;border-radius: 8px;text-decoration:none;font-size:13px}
.ai-input{display:flex;gap:8px;padding:10px;border-top:1px solid #e2e8f0;background:#fff}
.ai-input input{flex:1;border:1px solid #e2e8f0;border-radius: 12px;padding:9px 12px;font-size:13.5px;outline:none}
.ai-input input:focus{border-color:#8b5cf6}
.ai-input button{background:var(--primary);color:#fff;border:0;border-radius: 12px;padding:0 16px;font-size:13.5px;cursor:pointer}
@media(max-width:640px){#ai-panel{right:14px;left:14px;width:auto;bottom:84px}}

.ai-cam{display:flex;align-items:center;justify-content:center;width:40px;border:1px solid #e2e8f0;border-radius: 12px;font-size:18px;cursor:pointer;background:#fff}
.ai-cam:hover{background:#f1f5f9}

/* ===== 系统配置页 2.0：限宽居中 + 精修导航/分组/入口条 ===== */
.cfg-page{max-width:none}
.cfg-group{
  margin:26px 0 12px;font-size:14px;font-weight:700;color:#475569;
  display:flex;align-items:center;gap:8px;
}
.cfg-group::before{content:"";width:4px;height:16px;border-radius: 3px;background:linear-gradient(180deg,#6366f1,#8b5cf6)}
.cfg-group::after{content:"";flex:1;height:1px;background:#e2e8f0}
.cfg-group:first-of-type{margin-top:8px}
.cfg-grid > .card{margin-top:0}

/* AI 助手配置卡：两个分组（对话模型 / OCR 视觉）平铺区分 */
.ai-group{border:1px solid #e2e8f0;border-radius: 12px;padding:6px 16px 14px;margin:0 0 14px;background:#fafbfc}
.ai-group legend{
  padding:0 8px;font-size:13.5px;font-weight:700;color:#334155;
  display:flex;align-items:center;gap:6px;
}
.ai-group legend span{font-weight:400;font-size:12px;color:#94a3b8}
.ai-group .ai-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px 16px;margin-top:6px}
.ai-group .form-row{margin:0}

.ai-group-ops{display:flex;align-items:center;gap:10px;margin-top:12px;padding-top:10px;border-top:1px dashed #e2e8f0;flex-wrap:wrap}
.ai-test-msg{font-size:12.5px}

/* ============================================================
   设计系统 v2 —— 对齐主流后台（Admin）视觉
   说明：不改结构，仅覆盖组件样式；变量统一在 :root
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e9f0;
  --border-strong: #d8dee9;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
  --topbar-h: 56px;
}

/* ---------- 页面标题区（主流：大标题 + 描述 + 右侧操作） ---------- */
.content > h1, .content h1 {
  font-size: 20px; font-weight: 700; letter-spacing: -.2px;
  margin: 0 0 6px; color: var(--text);
}
.content > h1 + p.muted { margin-bottom: 16px !important; }

/* ---------- 顶栏：白底吸顶 + 细边框 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 80;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 15px; font-weight: 650; color: var(--text); }
.topbar-user {
  margin-left: auto; font-size: 13px; color: #475569;
  background: #f1f5f9; border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px;
}

/* ---------- 侧边栏：白底 + 圆角菜单项 + 激活态主色浅底 ---------- */
.sidebar { background: #fff; border-right: 1px solid var(--border); }
.sidebar .brand { padding: 18px 18px 14px; font-size: 15.5px; }
.sidenav { padding: 6px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidenav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #475569; font-size: 13.5px; font-weight: 500;
  text-decoration: none; transition: background .12s, color .12s;
  position: relative;
}
.sidenav a:hover { background: #f1f5f9; color: var(--text); }
.sidenav a.active, .sidenav a[aria-current="page"] {
  background: var(--primary-light); color: var(--primary-dark); font-weight: 650;
}
.sidenav a.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.sidenav a .ic { font-size: 15px; width: 20px; text-align: center; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}
.card-head h2 { font-size: 15px; font-weight: 650; color: var(--text); }
.card-head .sub { font-size: 12.5px; color: var(--muted); }

/* ---------- 表格（主流紧凑风） ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table th {
  background: #f8fafc; color: #64748b; font-size: 12.5px; font-weight: 650;
  text-align: center; padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table tbody tr:last-child td, table tr:last-child td { border-bottom: 0; }
table tr:hover td { background: #fafbff; }
table.tbl-center th, table.tbl-center td { text-align: center; }
table .num { font-variant-numeric: tabular-nums; }

/* ---------- 按钮 ---------- */
.btn {
  border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px;
  box-shadow: none; transition: all .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* ---------- 表单 ---------- */
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=file], select, textarea {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; font-size: 13.5px; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
label { font-size: 13px; color: #475569; font-weight: 500; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s;
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .num { font-size: 24px; font-weight: 750; line-height: 1.2; letter-spacing: -.5px; }
.stat .label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 徽章 ---------- */
.badge { border-radius: 999px; font-size: 11.5px; font-weight: 650; padding: 3px 10px; }

/* ---------- 内容区留白 ---------- */
.content { padding: 22px 26px 40px; }
@media (max-width: 720px) { .content { padding: 16px 14px 32px; } }

/* ============================================================
   设计系统 v3 —— 深色侧栏 + 面包屑/搜索顶栏 + KPI 图标（对齐主流 WMS）
   ============================================================ */
/* ---------- 深色侧栏 ---------- */
.sidebar {
  background: #111827 !important;
  border-right: 1px solid #1f2937 !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
.sidebar .brand {
  background: none; -webkit-text-fill-color: #fff; color: #fff !important;
  padding: 18px 18px 14px; font-size: 15.5px; font-weight: 700;
}
.sidenav { padding: 4px 10px 12px; }
.sidenav .grp {
  padding: 14px 12px 6px; font-size: 11px; letter-spacing: .8px;
  color: #5d6b82; font-weight: 600;
}
.sidenav a {
  color: #c3ccda !important; border-radius: 8px; margin: 2px 0;
  padding: 9px 12px; font-size: 13.5px;
}
.sidenav a:hover { background: #1c2434 !important; color: #fff !important; }
.sidenav a.active, .sidenav a[aria-current="page"] {
  background: var(--primary) !important;
  color: #fff !important; font-weight: 650;
  box-shadow: var(--shadow-lg);
}
.sidenav a.active::before { display: none; }
.sidebar-ver { color: #64748b !important; border-color: #1f2937 !important; }
.sidebar-ver .dot { background: #22c55e; }
.sidebar-ver code { color: #94a3b8 !important; }
.sidebar-user {
  background: #0d1420; border-top: 1px solid #1f2937 !important;
  color: #93a0b4 !important;
}
.sidebar-user .btn { background: #1c2434 !important; color: #cbd5e1 !important; border: 1px solid #2b3648 !important; }
.sidebar-user .btn:hover { background: #243049 !important; color: #fff !important; }

/* ---------- 顶栏：面包屑 + 全局搜索 + 头像 ---------- */
.topbar { height: 58px; padding: 0 22px; gap: 14px; }
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.crumb b { color: var(--text); font-weight: 650; }
.topbar .gsearch {
  margin-left: auto; width: 280px; max-width: 34vw; height: 36px;
  border: 1px solid var(--border); border-radius: 8px; background: #fafbfd;
  padding: 0 12px; font-size: 13px;
}
.topbar .gsearch:focus { background: #fff; }
.topbar-user {
  margin-left: 0 !important; display: inline-flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--border); padding: 4px 12px 4px 4px;
  border-radius: 999px; font-size: 13px; color: #334155;
}
.topbar-user::before {
  content: "管"; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
@media (max-width: 820px) {
  .topbar .gsearch { display: none; }
  .crumb { font-size: 12.5px; }
}

/* ---------- KPI 统计卡：图标 + 数字（兼容两种结构） ---------- */
/* 结构A（首页等）：stat-icon + num + label 平铺 → 图标做成圆角色块 */
.stat .stat-icon {
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 8px;
  display: grid; place-items: center; font-size: 19px;
  background: var(--primary-light); color: var(--primary-dark);
}
/* 结构B（图标 + 内容并排）：仅当卡内有 .ico 时启用横向布局 */
.stat:has(.ico) { display: flex; align-items: flex-start; gap: 12px; }
.stat .ico {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--primary-light); color: var(--primary-dark);
}
.stat .ico.g { background: #e7f7ee; color: #0f9d58; }
.stat .ico.o { background: #fdf3e3; color: #b7791f; }
.stat .ico.r { background: #fdeaea; color: #c53030; }
.stat .body { min-width: 0; }
.stat .num { font-size: 23px; }

.topbar-user::before { display: none !important; }
.topbar-user .av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; font-style: normal;
}

/* 右列：顶栏 + 内容（修复顶栏占列问题） */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-col .topbar { width: 100%; }
.main-col .content { flex: 1; }

/* ============================================================
   设计系统 v4 —— 表单 / 表格 / 按钮 规范化（对齐主流 Admin 密度）
   ============================================================ */
/* ---------- 按钮：统一尺寸（34px 高），不再出现超大按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; font-size: 13.5px; font-weight: 600;
  border-radius: 8px; box-shadow: none;
  background: var(--primary); color: #fff;
}
.btn:hover { filter: brightness(1.06); box-shadow: var(--shadow-lg); }
.btn.small { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn.gray { background: #fff; color: #334155; border: 1px solid var(--border-strong); }
.btn.gray:hover { background: #f8fafc; box-shadow: var(--shadow-sm); }
.btn.danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.btn.danger:hover { background: #fecaca; box-shadow: none; }

/* ---------- 输入控件：统一 34px 高、紧凑内边距 ---------- */
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=search], select, textarea {
  height: 34px; padding: 0 10px; border-radius: 8px; font-size: 13.5px;
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 8px 10px; }
select { padding-right: 26px; }
input[type=file] { height: auto; padding: 6px 10px; font-size: 13px; }
input[type=file]::file-selector-button {
  height: 26px; padding: 0 12px; margin-right: 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: #f8fafc; color: #334155; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: #eef2f7; }

/* ---------- 表格内嵌表单控件：更紧凑 ---------- */
table input[type=text], table input[type=number], table select {
  height: 32px; padding: 0 8px; font-size: 13px; border-radius: 8px;
}
table .btn.small { height: 28px; }

/* ---------- 表单网格：标签在上、间距统一 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row > label { font-size: 12.5px; color: #475569; font-weight: 600; }
.form-row > input, .form-row > select, .form-row > textarea { width: 100%; }

/* ---------- 明细行表格：列宽自动分配更合理（去掉自动拉伸） ---------- */
table#lines td { padding: 7px 8px; }
table#lines th { padding: 9px 8px; font-size: 12px; }
table#lines input, table#lines select { height: 32px; }
/* 明细区「添加一行」：虚线上块（主流表单风格） */
.add-line-bar {
  width: 100%; height: 38px; margin-top: 8px;
  border: 1.5px dashed var(--border-strong) !important; border-radius: 12px !important;
  background: #fafbfd !important; color: var(--primary) !important; font-weight: 600;
  box-shadow: none !important;
}
.add-line-bar:hover { background: #f2f5ff !important; border-color: var(--primary) !important; }

/* 明细行内的开关标签不换行（资产/应急列） */
table#lines td label { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
table#lines th { white-space: nowrap; }

/* ============================================================
   设置页布局（系统配置）：左侧分类导航 + 右侧区块
   ============================================================ */
.cfg-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
.cfg-main { min-width: 0; }
.cfg-main .cfg-group { scroll-margin-top: 74px; }
.cfg-main .card { scroll-margin-top: 74px; }
/* 手机 / 窄屏：导航变横向滚动条 */
@media (max-width: 900px) {
  .cfg-layout { grid-template-columns: 1fr; gap: 14px; }
}

/* ============================================================
   通用「区块导航」布局（.sec-*）：与系统配置页 .cfg-* 同规则
   ============================================================ */
.sec-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.sec-main { min-width: 0; }
.sec-main .card { scroll-margin-top: 74px; }
@media (max-width: 900px) {
  .sec-layout { grid-template-columns: 1fr; gap: 14px; }
}

/* 顶部横向区块标签（较少区块的页面：业务记录 / 领出归还 / 固定资产） */

/* ============================================================
   设计系统 v5 —— 仓储务实风（Industrial Warehouse）
   设计方向：为「仓库管理」这一具体业务做的取舍，而非通用 SaaS 模板
   · 去「万物皆卡片 + 统一圆角 + 同一灰阴影」：分区用细边框与分隔线
   · 数字用等宽对齐（库存/金额可扫读），单位小字后缀
   · 状态徽章改「货架标签」质感（左色块 + 小圆角），非全圆胶囊
   · 颜色取自仓储语汇：钢蓝（作业）/ 苔绿（在库）/ 琥珀（待补货）/ 砖红（缺货报废）
   ============================================================ */
:root {
  /* 作业主色：钢蓝（工业感，替代通用靛紫） */
  --primary: #16549b;
  --primary-dark: #0f3f78;
  --primary-light: #e9f1fa;
  /* 中性：工程灰 */
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #16202b;
  --muted: #5f6b7a;
  --border: #e1e6ed;
  --border-strong: #cfd7e0;
  /* 语义：仓储状态语言 */
  --success: #0f7a4d;   /* 在库 / 正常 */
  --warn: #b45309;      /* 待补货 / 低库存 */
  --danger: #b42318;    /* 缺货 / 报废 */
  /* 收敛圆角与阴影：工具感，不做「胶囊化」 */
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 28px rgba(16, 24, 40, .14);
}
/* 数字等宽：库存 / 金额 / 编号 一致对齐（专业扫读的关键） */
body, table, .num, .stat .num, input[type=number] { font-variant-numeric: tabular-nums; }
table td.num, .stat .num { font-feature-settings: "tnum" 1; }

/* ---------- 卡片：去掉「圆角 + 灰阴影」双件套，改细边框 + 紧凑圆角 ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}
.card-head { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14.5px; font-weight: 650; letter-spacing: .1px; }
.card-head .sub { font-size: 12px; color: var(--muted); }

/* ---------- KPI 卡：去掉顶部渐变彩条（模板味重）→ 左侧色条 + 数字主导 ---------- */
.stats { gap: 12px; }
.stat, .stat:has(.ico) {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: none; padding: 14px 16px 14px 17px; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--primary); opacity: .85;
}
.stat.g-edge::before { background: var(--success); }
.stat.o-edge::before { background: var(--warn); }
.stat.r-edge::before { background: var(--danger); }
.stat .num { font-size: 24px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; }
.stat .label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 徽章：货架标签质感（左色块 + 小圆角），不做全圆胶囊 ---------- */
.badge, .tag {
  border-radius: 3px; padding: 2px 8px 2px 7px; font-size: 11.5px; font-weight: 650;
  border: 1px solid transparent; position: relative; padding-left: 11px;
}
.badge::before, .tag::before {
  content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 11px; border-radius: 3px; background: currentColor; opacity: .75;
}

/* ---------- 表格：主角。表头略深、行线细、悬停克制 ---------- */
table th {
  background: #f7f9fb; color: #4a5565; font-size: 12px; font-weight: 650;
  letter-spacing: .2px; border-bottom: 1px solid var(--border-strong);
}
table td { border-bottom: 1px solid #eef1f5; }
tbody tr:hover td, table tr:hover td { background: #f8fafc; }

/* ---------- 侧栏：钢蓝墨色，激活态用实心块（非渐变） ---------- */
.sidebar { background: #0e1721 !important; }
.sidenav a.active, .sidenav a[aria-current="page"] {
  background: var(--primary) !important; box-shadow: none !important;
}
.sidenav .grp { color: #56677d !important; }

/* ---------- 按钮：实色、紧凑、无渐变 ---------- */
.btn { background: var(--primary); border-radius: 8px; font-weight: 600; }
.btn:hover { background: var(--primary-dark); filter: none; box-shadow: none; }
.topbar .gsearch, input, select, textarea { border-radius: 8px; }

/* ============================================================
   登录页重做（v5）：以「库位网格」为视觉母题，替代通用渐变 + 光晕
   ============================================================ */
.login-page {
  background: #0e1721 !important;
  position: relative; overflow: hidden;
  /* 库位网格：模拟货架分格（2 层淡网格 + 顶部/底部沉降） */
  background-image:
    linear-gradient(rgba(120, 150, 185, .085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 185, .085) 1px, transparent 1px),
    radial-gradient(1100px 520px at 50% -10%, rgba(22, 84, 155, .35), transparent 70%) !important;
  background-size: 56px 56px, 56px 56px, 100% 100% !important;
  padding: 40px 20px;
}
.login-blob { display: none !important; }   /* 去掉光晕装饰 */
.login-card {
  background: #fff; border: 1px solid #d7dee7; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 30px 28px 24px; max-width: 400px; width: 100%;
  position: relative;
}
.login-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--primary); border-radius: 12px 12px 0 0;
}
/* 品牌区：左对齐的紧凑标题（不做居中大 Logo 的模板排法） */
.login-brand { text-align: left !important; margin-bottom: 22px; display: flex; align-items: center; gap: 11px; }
.login-logo {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px;
  background: var(--primary-light); color: var(--primary);
  display: grid; place-items: center; font-size: 20px;
  border: 1px solid #cfe0f2; box-shadow: none;
}
.login-brand h1 { font-size: 17.5px; font-weight: 700; letter-spacing: .2px; line-height: 1.25; }
/* 表单：标签在上（中文小字），字段紧凑 —— 像一张登记单 */
.login-form { display: flex; flex-direction: column; gap: 13px; }
.login-field { position: relative; display: flex; flex-direction: column; gap: 5px; }
.login-field::before {
  font-size: 12px; color: #4a5565; font-weight: 600;
}
.login-field:nth-of-type(1)::before { content: "用户名"; }
.login-field:nth-of-type(2)::before { content: "密码"; }
.login-field .login-field-ic {
  display: none !important;
}
.login-field input {
  height: 40px !important; padding: 0 12px !important; border-radius: 8px;
  border: 1px solid var(--border-strong) !important; background: #fff;
  font-size: 14px; box-shadow: none !important;
}
.login-field input:focus { border-color: var(--primary) !important; box-shadow: var(--shadow-sm); }
.login-btn {
  height: 42px; margin-top: 4px; border-radius: 8px; border: 0;
  background: var(--primary); color: #fff; font-size: 14.5px; font-weight: 650; letter-spacing: 1px;
  cursor: pointer; box-shadow: none;
}
.login-btn:hover { background: var(--primary-dark); transform: none; box-shadow: none; }
.login-meta { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center !important; }
.login-meta p { font-size: 11.5px; color: var(--muted); }
.ver-tag { background: #f1f4f8; border: 1px solid var(--border); color: #55606e !important; border-radius: 8px; padding: 1px 7px; font-size: 11px; }
/* 登录卡下方的系统状态行（取自真实运行特性，非装饰） */
.login-status {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin-top: 16px; color: #7f8ea3; font-size: 11.5px;
}
.login-status i { font-style: normal; display: inline-flex; align-items: center; gap: 5px; }
.login-status .dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; display: inline-block; }

/* 登录页修正：logo + 文字两列（标题/副标题分行）、状态行置于卡片下方 */
.login-page { flex-direction: column !important; align-items: center !important; justify-content: center !important; min-height: 100vh; padding: 24px 16px 32px; }
.login-brand {
  display: grid !important; grid-template-columns: 40px 1fr; column-gap: 11px;
  row-gap: 0; align-items: center; text-align: left !important;
}
.login-brand .login-logo { grid-row: 1 / span 2; grid-column: 1; }
.login-brand h1 { grid-column: 2; grid-row: 1; font-size: 17.5px; }
.login-status { flex-basis: auto; width: auto; }

/* 侧栏菜单线性图标（替代 emoji）：统一 18px、1.7 描边、随文字色 */
.sidenav a .ic { width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center; font-size: 0; }
.sidenav a .ic svg { width: 18px; height: 18px; display: block; }
.sidenav a.active .ic svg, .sidenav a:hover .ic svg { opacity: 1; }
.sidenav a .ic svg { opacity: .85; }

/* ============================================================
   标题层级（代替 emoji）：靠字号 / 字重 / 颜色 / 位置建立层级
   ============================================================ */
h1 {
  font-size: 20px; font-weight: 700; letter-spacing: .2px;
  padding-left: 13px; margin-bottom: 14px; color: #101a24;
}
h1::before {
  width: 4px; height: 20px; border-radius: 3px;
  background: var(--primary);   /* 竖条改钢蓝（去紫色渐变） */
}
h2 { font-size: 15px; font-weight: 650; color: #16202b; margin-bottom: 10px; }
.card-head h2 { color: #16202b; }
h3 { font-size: 14px; font-weight: 650; color: #2b3644; }
.cfg-group { color: #47515f; font-size: 13.5px; }
.cfg-group::before { background: var(--primary) !important; }   /* 分组竖条同主色 */
/* 语义标题（原 emoji 表达的含义转为颜色） */
.h-warn { color: var(--danger) !important; }
.h-ok { color: var(--success) !important; }

/* ============================================================
   内联线性图标（.bi）：替代按钮 / 提示行 / 徽章中的 emoji
   ============================================================ */
.bi {
  width: 15px; height: 15px; flex: 0 0 auto;
  vertical-align: -3px; margin-right: 5px;
  opacity: .92;
}
.btn .bi, .op-text .bi, a.btn .bi, button.btn .bi { vertical-align: -3px; }
.btn .bi:last-child, .op-text .bi:last-child { margin-right: 0; }
.badge .bi, .tag .bi { width: 12px; height: 12px; margin-right: 3px; vertical-align: -2px; }
.stat-icon .bi { width: 20px; height: 20px; margin: 0; }
.upload-ic .bi { width: 34px; height: 34px; margin: 0; opacity: .45; }
p.muted .bi, .sub .bi, .tip .bi { color: var(--primary); }
.t-orange .bi, .h-warn .bi { color: inherit; }
.empty-ic .bi { width: 36px; height: 36px; margin: 0; opacity: .4; }

/* 补齐缺失的徽章语义色（模板在用但此前未定义 → 显示为无色） */
.badge.danger { background: #fdeaea; color: #b42318; }
.badge.warn { background: #fdf3e3; color: #b45309; }

/* ============================================================
   设计审查修正（frontend-design 复盘）
   · 去掉「颜色不携带信息」的装饰（按序号轮换的彩虹渐变线）
   · 数字与金额回归中性：语义色只用于状态，不用于普通数值
   · 动效收敛：卡片不再整块浮起
   · AI 助手脱离旧紫主题，跟随钢蓝
   ============================================================ */
/* 1) KPI 卡装饰线：统一主色左色条（删除 nth-child 彩虹渐变） */
.stat::before,
.stat:nth-child(2n)::before, .stat:nth-child(3n)::before, .stat:nth-child(4n)::before,
.stat:nth-child(5n)::before, .stat:nth-child(6n)::before {
  top: 0 !important; bottom: 0 !important; left: 0 !important; right: auto !important;
  width: 3px !important; height: auto !important;
  background: var(--primary) !important;
}
/* 2) 统计数字回归墨色（同页 5 种颜色 = 噪音）；仅真警示保留红 */
/* 统计卡数字：默认统一深色（避免满屏彩色数字），只给语义色开例外 */
.stat .num { color: #101a24 !important; }
.stat .num.green, .stat .num.amber { color: #101a24 !important; }
.stat .num.red { color: var(--danger) !important; }
/* 在库=绿 / 在用=蓝：与表格徽章（badge.ok / badge.center）同一套语义，
   资产台账统计卡、库存查询等页面保持一致 */
.stat .num.st-instock { color: var(--success) !important; }
.stat .num.st-inuse { color: var(--primary) !important; }
/* 送修 / 已报废 的统计卡同样给语义色（原 .t-orange / .t-red 被上面的 !important 压成深色，
   导致有值时也看不出是提醒色） */
.stat .num.t-orange { color: var(--warn) !important; }
.stat .num.t-red { color: var(--danger) !important; }
.stat .label { color: var(--muted); }
a.stat .label { color: var(--primary); }
/* 3) 金额不再用绿色（绿=在库/正常，不表示「有金额」） */
td.money, .money { color: #101a24 !important; }
/* 4) 卡片 hover：去掉整块浮起与阴影跳动（技能点名的通用动效） */
.card, .stat { transition: border-color .12s ease !important; }
.stat:hover { transform: none !important; box-shadow: none !important; border-color: var(--border-strong) !important; }
/* 5) AI 助手：跟随钢蓝主题（含浮窗、面板头、用户气泡） */
#ai-fab { background: var(--primary) !important; box-shadow: var(--shadow-lg); }
#ai-fab:hover { transform: none !important; }
.ai-head { background: var(--primary) !important; }
.ai-msg.user { background: var(--primary) !important; }
#ai-panel { border-radius: 12px !important; }
/* 6) 表格：长内容列不换行、备注限宽，行高整齐 */
table td.nowrap, table th.nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.table-scroll table td:nth-child(2) { max-width: 220px; }
.table-scroll { overflow-x: auto; }

/* ============================================================
   首页信息优先级：关键指标条 + 次级指标行（替代 11 张数字卡片阵列）
   ============================================================ */
.kpi-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.kpi-item {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 5px;
  padding: 13px 16px; background: #fff; text-decoration: none; color: inherit;
}
.kpi-item .k { flex-basis: 100%; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.kpi-item .v { font-size: 22px; font-weight: 700; letter-spacing: -.4px; line-height: 1.15; }
.kpi-item .u { font-size: 12px; color: var(--muted); }
.kpi-item.warn .v { color: var(--warn); }
.kpi-item:hover { background: #fafbfd; }
.kpi-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* 次级指标：一行文字（今日与专项），不做成大数字卡 */
.mini-stats {
  display: flex; flex-wrap: wrap; gap: 6px 22px;
  font-size: 13px; color: var(--muted); margin: 0 0 16px;
  padding: 11px 16px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.mini-stats b { color: var(--text); font-weight: 650; margin-left: 2px; }
.mini-stats a { color: var(--primary); text-decoration: none; }
.mini-stats a:hover { text-decoration: underline; }

/* 累计汇总行（替代历史统计里的 4 张数字卡） */
.io-summary {
  display: flex; flex-wrap: wrap; gap: 8px 26px;
  font-size: 13.5px; color: #47515f;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.io-summary b { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .kpi-item { padding: 11px 13px; }
  .kpi-item .v { font-size: 19px; }
  .mini-stats { gap: 5px 16px; font-size: 12.5px; }
}
.cfg-grid-2 .card { margin-top: 0; }

/* 2) 字典表：紧凑行高、名称左对齐、数量居中、操作右对齐固定宽 */
table.cfg-table { font-size: 13.5px; }
table.cfg-table th { padding: 9px 12px; font-size: 12px; }
table.cfg-table td { padding: 9px 12px; }
table.cfg-table th:first-child, table.cfg-table td:first-child { text-align: left; }
table.cfg-table th:last-child, table.cfg-table td:last-child {
  text-align: right; width: 116px; white-space: nowrap;
}
/* 第二列（数量 / 联动标记）居中，避免整表居中造成的空旷 */
table.cfg-table th:not(:first-child):not(:last-child),
table.cfg-table td:not(:first-child):not(:last-child) { text-align: center; }

/* 3) 危险操作降级：由「实心红按钮」改为文字按钮（hover 才提示危险） */
.btn.danger {
  background: #fff; color: #b42318; border: 1px solid #f0cdc9;
  height: 30px; padding: 0 12px; font-size: 12.5px; font-weight: 600; box-shadow: none;
}
.btn.danger:hover { background: #fdeaea; border-color: #e5a9a3; }
.btn.small.danger { height: 28px; padding: 0 10px; }

/* 4) 折叠式编辑入口（details/summary）统一为文字操作 */
details.cfg > summary {
  cursor: pointer; color: var(--primary); font-size: 12.5px; font-weight: 600;
  list-style: none; display: inline-block; padding: 2px 0;
}
details.cfg > summary::-webkit-details-marker { display: none; }
details.cfg > summary::after { content: ""; }
details.cfg > summary:hover { text-decoration: underline; }
details.cfg > form { margin-top: 8px; }

/* 5) 卡片内的「新增」行统一间距与对齐 */
.cfg-grid-2 .card > form.toolbar:first-of-type,
.card > form.toolbar { gap: 10px; }
.card > form.toolbar .btn { flex: 0 0 auto; }

/* 配置页表格细化：列宽按比例分配（避免空白聚集）+ 操作按钮横排（不再撑高行高） */
table.cfg-table { table-layout: fixed; width: 100%; }
table.cfg-table th:first-child, table.cfg-table td:first-child { width: 34%; }
table.cfg-table th:last-child, table.cfg-table td:last-child { width: 128px; }
table.cfg-table td:first-child { word-break: break-word; }
/* 操作列：折叠/表单横排，居中偏右 */
table.cfg-table td:last-child { white-space: nowrap; }
table.cfg-table td:last-child form { display: inline-block; vertical-align: middle; }
table.cfg-table td:last-child form + form { margin-left: 6px; }
table.cfg-table td:last-child details { display: inline-block; vertical-align: middle; }
table.cfg-table td:last-child details + form { margin-left: 6px; }
table.cfg-table td:last-child .btn { vertical-align: middle; }
/* 表格内徽章不换行 */
table.cfg-table .badge { white-space: nowrap; }

/* 配置页表格列宽微调：中间列不抢宽度（余量归首列）；仓库表 ID 窄、名称宽 */
table.cfg-table th:nth-last-child(2), table.cfg-table td:nth-last-child(2) { width: 24%; }
table.cfg-table.wh-table th:first-child, table.cfg-table.wh-table td:first-child { width: 72px; text-align: center; }
table.cfg-table.wh-table th:nth-child(2), table.cfg-table.wh-table td:nth-child(2) { width: auto; }
table.cfg-table.wh-table th:nth-child(n+3):not(:last-child),
table.cfg-table.wh-table td:nth-child(n+3):not(:last-child) { width: 120px; }

/* 列宽收尾：首列吸收剩余宽度（避免多余宽度堆到最后一列） */
table.cfg-table th:first-child, table.cfg-table td:first-child { width: auto; }
table.cfg-table.wh-table th:first-child, table.cfg-table.wh-table td:first-child { width: 72px; }

/* ============================================================
   业务字典：单卡片 + 标签切换（整合物资分类/用途/应急用途/出库类型）
   ============================================================ */
.dict-tabs {
  display: flex; gap: 2px; padding: 6px 10px 0; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); background: #fcfdfe;
}
.dict-tab {
  border: 0; background: none; cursor: pointer;
  padding: 10px 15px; margin-bottom: -1px;
  font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.dict-tab:hover { color: var(--text); }
.dict-tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.dict-panel { display: none; padding: 15px 16px 17px; }
.dict-panel.on { display: block; }
/* 面板首行表单/表格不再多加顶部间距 */
.dict-panel > form.toolbar:first-child { margin-top: 0; }
.dict-panel > table.cfg-table:first-child { margin-top: 0; }
@media (max-width: 620px) {
  .dict-tabs { padding: 6px 8px 0; gap: 0; }
  .dict-tab { padding: 9px 11px; font-size: 12.5px; }
  .dict-panel { padding: 13px 12px 15px; }
}

/* 物资分类小类表：宽度按内容（不铺满），列宽收敛 */
table.cfg-table.cat-table { width: auto; min-width: 560px; }
table.cfg-table.cat-table th:first-child, table.cfg-table.cat-table td:first-child { width: auto; }
table.cfg-table.cat-table th:nth-last-child(2), table.cfg-table.cat-table td:nth-last-child(2) { width: 110px; }
table.cfg-table.cat-table th:last-child, table.cfg-table.cat-table td:last-child { width: 120px; }
/* 分组表头（第一个大类）下增加一点间距，分组之间更清晰 */
table.cfg-table.cat-table tr:first-child th { padding-top: 10px; padding-bottom: 10px; }

/* ============================================================
   物资分类：大类卡片组（每类一卡、自动多列），内容不再拉满整宽
   ============================================================ */
.cat-top-row { display: flex; gap: 10px; }
.cat-top-row input { max-width: 340px; }
.cat-grid {
  /* auto-fit（不是 auto-fill）：宽屏下若只剩 3 个大类，auto-fill 会预留一个空的第 4 列轨道，
     卡片只占左侧 2/3、右边大片留白；auto-fit 会把空轨道折叠掉，让卡片拉伸铺满。 */
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px; margin-top: 14px; align-items: start;
}
.cat-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 13px 13px; background: #fff;
}
.cat-item-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 9px;
}
.cat-item-head b { font-size: 14px; font-weight: 650; }
.cat-item-head .cnt { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.cat-item-head .ops { display: flex; align-items: center; gap: 8px; }
/* 卡内小类表：铺满卡片、列宽紧凑 */
table.cat-table { width: 100% !important; min-width: 0 !important; }
table.cat-table th:first-child, table.cat-table td:first-child { width: auto; }
table.cat-table th:nth-last-child(2), table.cat-table td:nth-last-child(2) { width: 78px; }
table.cat-table th:last-child, table.cat-table td:last-child { width: 92px; }
table.cat-table td, table.cat-table th { padding: 8px 10px; }
/* 卡内「添加小类」行 */
.cat-add-row { display: flex; gap: 8px; margin-top: 9px; }
.cat-add-row input { flex: 1; min-width: 0; max-width: none; }
@media (max-width: 820px) { .cat-grid { grid-template-columns: 1fr; } }

/* ============================================================
   用户管理内联（配置页内，不跳页）：横向新增表单 + 表格内折叠编辑
   ============================================================ */
.user-add-form {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end; gap: 10px 14px; margin-bottom: 15px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.user-add-form .form-row-btn { justify-content: flex-end; }
.chk-inline {
  display: flex; align-items: center; gap: 7px; font-weight: 400;
  height: 34px; font-size: 13.5px;
}
.chk-inline input { width: auto; }
.user-edit-form { display: grid; gap: 9px; margin: 9px 0 0; min-width: 230px; text-align: left; }
.user-edit-form .form-row { gap: 4px; }
.user-edit-form .btn { justify-self: start; }
/* 用户表列宽：ID 窄、时间/操作定宽 */
table.cfg-table.user-table th:first-child, table.cfg-table.user-table td:first-child {
  width: 52px; text-align: center;
}
table.cfg-table.user-table th:nth-last-child(2), table.cfg-table.user-table td:nth-last-child(2) { width: 152px; }
table.cfg-table.user-table th:last-child, table.cfg-table.user-table td:last-child { width: 168px; }

/* ============================================================
   修改用户弹窗（替代表格内展开表单，避免横向溢出）
   ============================================================ */
.op-link {
  background: none; border: 0; cursor: pointer; padding: 2px 5px;
  color: var(--primary); font-size: 12.5px; font-weight: 600;
}
.op-link:hover { text-decoration: underline; }
.user-edit-form { display: grid; gap: 10px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 16px; }
/* 操作列收窄（不再塞展开表单） */
table.cfg-table.user-table th:last-child, table.cfg-table.user-table td:last-child { width: 134px; }
/* 表格与滚动容器：确保任何情况下都不撑破页面 */
#cfg-users .table-scroll { max-width: 100%; }

/* ============================================================
   修复表格操作列溢出：固定列宽（table-layout:fixed）下末列装不下按钮 → 溢出 28px 触发横向滚动条
   改为按内容自适应列宽（保留 width 作为建议值），并给操作列内元素紧凑间距
   ============================================================ */
table.cfg-table { table-layout: auto; }
table.cfg-table td:last-child, table.cfg-table th:last-child { white-space: nowrap; }
table.cfg-table td:last-child form { display: inline-block; margin-left: 6px; }
table.cfg-table td:last-child .btn.small.danger { height: 27px; padding: 0 9px; }
table.cfg-table td:last-child .op-link { padding: 2px 3px; }
/* 兜底：表格滚动容器不显示多余滚动条 */
#cfg-users .table-scroll, .card .table-scroll { overflow-x: auto; }

/* 弹窗内负责仓库多选：紧凑排列 */
.wh-picks { display: flex; flex-wrap: wrap; gap: 7px 16px; }
.wh-picks .chk-inline { height: auto; font-size: 13px; }

/* ============================================================
   弹窗高度修复：内容高于视口时不再上下被裁（改为遮罩层滚动）
   ============================================================ */
.modal-mask {
  align-items: flex-start !important;   /* 关键：不再垂直居中裁掉顶部/底部 */
  overflow-y: auto;                     /* 由遮罩层承载滚动 */
  padding: 5vh 20px 5vh !important;
}
.modal-card {
  max-height: none !important;          /* 取消卡片自身限高，避免按钮被裁 */
  margin: 0 auto;
}
/* 视口够高时仍居中显示（内容不超出时体验更好） */
@media (min-height: 820px) {
  .modal-mask { align-items: center !important; padding: 20px !important; }
  .modal-card { max-height: 88vh !important; overflow-y: auto; }
}
@media (max-width: 520px) {
  .modal-mask { padding: 14px !important; }
  .modal-card { padding: 18px 16px !important; }
}

/* 关键修复：卡片 hover 的 transform 会让内部 position:fixed 弹窗改为相对卡片定位（弹窗被裁）
   同时这也是设计审查点名的「卡片整块浮起」动效 → 一并去掉，仅保留边框提示 */
.card:hover, .stat:hover { transform: none !important; }
.card { transition: border-color .12s ease, box-shadow .12s ease; }

/* ============================================================
   业务记录表：列宽重新分配 + 对齐修正
   （全局 th,td 是居中的，文本列居中会显得松散；此处显式指定）
   ============================================================ */
table.rec-table { width: auto; min-width: 100%; table-layout: auto; }
table.rec-table th, table.rec-table td { text-align: left; }
/* 类型徽章 */
table.rec-table th:nth-child(1), table.rec-table td:nth-child(1) { width: 84px; text-align: center; }
/* 物资（名称/规格）：限宽，长规格换行 */
table.rec-table th:nth-child(2), table.rec-table td:nth-child(2) { width: 240px; max-width: 240px; }
/* 数量 / 金额：数字右对齐 */
table.rec-table th:nth-child(3), table.rec-table td:nth-child(3) { width: 62px; text-align: right; }
table.rec-table th:nth-child(4), table.rec-table td:nth-child(4) { width: 92px; text-align: right; }
/* 仓库/方向 */
table.rec-table th:nth-child(5), table.rec-table td:nth-child(5) { width: 148px; }
/* 用途 / 领用人 */
table.rec-table th:nth-child(6), table.rec-table td:nth-child(6) { width: 74px; text-align: center; }
table.rec-table th:nth-child(7), table.rec-table td:nth-child(7) { width: 78px; }
/* 备注：两行截断（悬停看全文），已由 .note-cell 处理，这里给足宽度 */
table.rec-table th:nth-child(8), table.rec-table td:nth-child(8) { width: 220px; }
table.rec-table th:nth-child(9), table.rec-table td:nth-child(9) { width: 82px; }
/* 时间 / 操作 */
table.rec-table th:nth-child(10), table.rec-table td:nth-child(10) { width: 122px; white-space: nowrap; }
table.rec-table th:nth-child(11), table.rec-table td:nth-child(11) { width: 134px; text-align: center; white-space: nowrap; }
/* 表格内操作图标按钮紧凑 */
table.rec-table td:last-child .rec-ops { display: flex; gap: 4px; justify-content: center; align-items: center; }
@media (max-width: 1200px) {
  table.rec-table th:nth-child(2), table.rec-table td:nth-child(2) { width: 190px; max-width: 190px; }
  table.rec-table th:nth-child(8), table.rec-table td:nth-child(8) { width: 170px; }
}

/* 业务记录表（v2）：固定比例布局，列宽稳定不失控；长文本省略号，行高整齐 */
table.rec-table {
  table-layout: fixed; width: 100%;
}
table.rec-table th, table.rec-table td { text-align: left; }
table.rec-table th:nth-child(1),  table.rec-table td:nth-child(1)  { width: 6%;   text-align: center; }  /* 类型 */
table.rec-table th:nth-child(2),  table.rec-table td:nth-child(2)  { width: 19%; }                         /* 物资 */
table.rec-table th:nth-child(3),  table.rec-table td:nth-child(3)  { width: 4.5%; text-align: right; }    /* 数量 */
table.rec-table th:nth-child(4),  table.rec-table td:nth-child(4)  { width: 6%;   text-align: right; }    /* 金额 */
table.rec-table th:nth-child(5),  table.rec-table td:nth-child(5)  { width: 12%; }                         /* 仓库/方向 */
table.rec-table th:nth-child(6),  table.rec-table td:nth-child(6)  { width: 5.5%; text-align: center; }   /* 用途 */
table.rec-table th:nth-child(7),  table.rec-table td:nth-child(7)  { width: 5.5%; }                        /* 领用人 */
table.rec-table th:nth-child(8),  table.rec-table td:nth-child(8)  { width: 16%; }                         /* 备注 */
table.rec-table th:nth-child(9),  table.rec-table td:nth-child(9)  { width: 5.5%; }                        /* 操作人 */
table.rec-table th:nth-child(10), table.rec-table td:nth-child(10) { width: 10%;  white-space: nowrap; }   /* 时间 */
table.rec-table th:nth-child(11), table.rec-table td:nth-child(11) { width: 10%;  text-align: center; white-space: nowrap; } /* 操作 */
/* 长文本列：单行省略号（完整内容悬停可见），行高统一 */
table.rec-table td:nth-child(2), table.rec-table td:nth-child(5),
table.rec-table td:nth-child(7), table.rec-table td:nth-child(9) {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.rec-table td:nth-child(10) { font-size: 12.5px; }
/* 操作列：图标按钮紧凑居中 */
table.rec-table td:last-child .rec-ops { display: flex; gap: 3px; justify-content: center; align-items: center; }
table.rec-table td:last-child .rec-ops .btn.small { height: 26px; padding: 0 7px; font-size: 12px; }
@media (max-width: 1100px) {
  table.rec-table th:nth-child(2), table.rec-table td:nth-child(2) { width: 16%; }
  table.rec-table th:nth-child(8), table.rec-table td:nth-child(8) { width: 14%; }
  table.rec-table td:nth-child(10) { font-size: 11.5px; }
}

/* 业务记录表（v3，最终）：取消 fixed（会导致可压缩列归零），改内容自适应 + 长文本单行省略 */
table.rec-table { table-layout: auto; width: auto; min-width: 100%; }
table.rec-table td:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
table.rec-table td:nth-child(1) { text-align: center; }
table.rec-table td:nth-child(3), table.rec-table td:nth-child(4) { text-align: right; }
table.rec-table td:nth-child(6) { text-align: center; }
table.rec-table td:last-child { text-align: center; }
table.rec-table td:last-child .rec-ops { gap: 4px; }
table.rec-table td:last-child .op-text { padding: 0 5px; }

/* 中等屏幕（常见笔记本 1280-1400）收窄物资列，避免表格内部横向滚动 */
@media (max-width: 1400px) {
  table.rec-table td:nth-child(2) { max-width: 190px; }
}

/* 窄屏（≤1400）：仓库/操作人列也允许省略号收缩，确保表格完整落在容器内 */
@media (max-width: 1400px) {
  table.rec-table td:nth-child(5) { max-width: 128px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.rec-table th:nth-child(5) { white-space: nowrap; }
  table.rec-table td:nth-child(9) { max-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.rec-table th:nth-child(9) { white-space: nowrap; }
  table.rec-table td:nth-child(7) { max-width: 66px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 1320px) {
  table.rec-table td:nth-child(8) { max-width: 150px; }   /* 备注列再收窄，消除 1280 下 12px 溢出 */
}

/* 1280 窄屏：操作列与时间列再紧凑，消除最后一处 12px 内部滚动 */
@media (max-width: 1320px) {
  table.rec-table td:last-child .rec-ops { gap: 2px !important; }
  table.rec-table td:last-child .op-text { padding: 0 3px !important; }
  table.rec-table td:nth-child(10) { font-size: 12px; }
}

/* 业务记录表（v4 定稿）：百分比固定布局 —— 任何视口下列宽按比例分配，不会出现某列被压垮 */
table.rec-table { table-layout: fixed; width: 100%; }
table.rec-table th:nth-child(1),  table.rec-table td:nth-child(1)  { width: 6%;   text-align: center; }
table.rec-table th:nth-child(2),  table.rec-table td:nth-child(2)  { width: 18%; }
table.rec-table th:nth-child(3),  table.rec-table td:nth-child(3)  { width: 4.5%; text-align: right; }
table.rec-table th:nth-child(4),  table.rec-table td:nth-child(4)  { width: 6.5%; text-align: right; }
table.rec-table th:nth-child(5),  table.rec-table td:nth-child(5)  { width: 11%; }
table.rec-table th:nth-child(6),  table.rec-table td:nth-child(6)  { width: 6%;   text-align: center; }
table.rec-table th:nth-child(7),  table.rec-table td:nth-child(7)  { width: 6%; }
table.rec-table th:nth-child(8),  table.rec-table td:nth-child(8)  { width: 15%; }
table.rec-table th:nth-child(9),  table.rec-table td:nth-child(9)  { width: 6%; }
table.rec-table th:nth-child(10), table.rec-table td:nth-child(10) { width: 11.5%; white-space: nowrap; font-size: 12.5px; }
table.rec-table th:nth-child(11), table.rec-table td:nth-child(11) { width: 9.5%; text-align: center; white-space: nowrap; }
/* 长文本：单行省略号（完整内容悬停可见），备注两行截断 */
table.rec-table td:nth-child(2), table.rec-table td:nth-child(5),
table.rec-table td:nth-child(7), table.rec-table td:nth-child(9) {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.rec-table td:nth-child(8) { max-width: none; }
table.rec-table td:last-child .rec-ops { display: flex; gap: 3px; justify-content: center; align-items: center; }
table.rec-table td:last-child .op-text { padding: 0 4px; }

/* 备注列修正：line-clamp 不能直接作用于 td（display:-webkit-box 会破坏表格单元格布局）
   改为内层 span 截断，td 恢复为普通单元格 */
table.rec-table td:nth-child(8) { display: table-cell !important; max-width: none !important; white-space: normal !important; }
.note-clamp {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.45; word-break: break-word;
}
table.cfg-table td .note-clamp { max-width: 100%; }

/* 业务字典卡内的说明行（原在页面最底部，位置易被误解为导航内容） */
.dict-note {
  display: flex; align-items: flex-start; gap: 7px;
  margin: 0; padding: 12px 16px 14px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); line-height: 1.6; background: #fcfdfe;
}
.dict-note .ic { flex: 0 0 auto; color: var(--primary); font-size: 0; }
.dict-note .ic svg { width: 15px; height: 15px; margin-top: 2px; }

/* ============================================================
   侧栏精致化（菜单保持左对齐——多菜单项扫读效率更高；品牌与底部居中/卡片化更美观）
   ============================================================ */
.sidebar .brand {
  justify-content: center; text-align: center;
  padding: 20px 16px 18px; gap: 9px;
}
.sidebar .brand .tx { letter-spacing: .5px; font-size: 15.5px; }
.sidebar .brand .ic { width: 26px; height: 26px; flex: 0 0 26px; }
.sidebar-ver { justify-content: center; text-align: center; font-size: 11.5px; padding: 8px 12px 10px; }
/* 底部用户区：卡片化（头像圆 + 名字省略 + 退出） */
.sidebar-user {
  margin: 8px 12px 12px; padding: 9px 11px; border-radius: 10px;
  background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .08);
  display: flex; align-items: center; gap: 9px;
}
.sidebar-user .ic {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
  background: rgba(255, 255, 255, .1); display: grid; place-items: center;
}
.sidebar-user .ic svg { width: 15px; height: 15px; }
.sidebar-user .tx {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px;
}
.sidebar-user .btn { flex: 0 0 auto; }
/* 菜单节奏：分组标题与项之间留白更均匀 */
.sidenav .grp { padding: 15px 12px 6px; }
.sidenav .grp:first-child { padding-top: 4px; }

/* 面板内的说明行：贴合面板内边距（不重复左右 padding），去掉卡片级底色 */
.dict-panel .dict-note {
  padding: 11px 0 0; background: none; border-top: 1px solid var(--border);
  margin-top: 14px;
}

/* ============================================================
   侧栏折叠（宽屏）：顶栏左侧按钮切换图标模式，内容区随之变宽
   ============================================================ */
@media (min-width: 769px) {
  body.nav-collapsed .sidebar { width: 68px !important; flex: 0 0 68px !important; }
  body.nav-collapsed .sidebar .brand .tx,
  body.nav-collapsed .sidebar-ver,
  body.nav-collapsed .sidebar-user .tx,
  body.nav-collapsed .sidebar-user .btn,
  body.nav-collapsed .sidenav .grp { display: none !important; }
  body.nav-collapsed .sidebar .brand { justify-content: center; padding: 18px 0; }
  body.nav-collapsed .sidenav { padding: 10px 8px; }
  body.nav-collapsed .sidenav a { justify-content: center; padding: 10px 0; }
  body.nav-collapsed .sidenav a .ic { margin: 0; }
  body.nav-collapsed .sidebar-user {
    justify-content: center; margin: 8px 8px 12px; padding: 8px 0;
  }
  /* 折叠时菜单文字一律隐藏。
     原先的做法是把 .tx 改成 position:absolute; left:100% 做 hover 悬浮标签，
     但 .sidenav 设了 overflow-y:auto，按 CSS 规范其 overflow-x 会被计算为 auto，
     于是伸出侧栏的标签撑出了**横向滚动条**（用户报"侧栏隐藏后有滑块"）。
     现改由 base.html 的脚本在 hover 时插入一个 position:fixed 的提示条 ——
     fixed 定位不参与任何滚动容器的尺寸计算，既保留提示又不会出现滚动条。 */
  body.nav-collapsed .sidenav a .tx { display: none !important; }
}

/* ============================================================
   侧栏版本卡：可读文案（系统运行中 / 版本日期），提交号移到悬停提示
   ============================================================ */
.sidebar-ver {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 6px 12px 4px; padding: 9px 12px;
  border-radius: 9px; background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
}
.sidebar-ver .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex: 0 0 7px;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
.sidebar-ver .tx { display: flex; flex-direction: column; line-height: 1.3; }
.sidebar-ver .tx b { font-size: 11.5px; font-weight: 600; color: #b7c5d6; }
.sidebar-ver .tx small { font-size: 10.5px; color: #6b7c92; }

/* ============================================================
   待确认单据卡片（入库/出库页）：识别/导入后未确认的单据入口
   —— 识别要十几秒，切走页面后回来仍能接着核对，不再丢记录
   ============================================================ */
.pending-card {
  border: 1px solid #d8e0ea; border-left: 3px solid #16549b; border-radius: 12px;
  background: #f7fafd; padding: 12px 14px; margin-bottom: 14px;
}
.pending-card .pc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pending-card .pc-head .bi { color: #16549b; }
.pending-card .pc-head b { font-size: 13.5px; }
.pending-card .pc-head .muted { font-size: 12.5px; }
.pending-card .pc-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.pending-card .pc-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e3e9f1; border-radius: 8px; padding: 8px 10px;
}
.pending-card .pc-src { font-size: 13px; font-weight: 600; color: #1f2a37; }
.pending-card .pc-meta { font-size: 12.5px; color: #64748b; font-variant-numeric: tabular-nums; }
.pending-card .pc-ops { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.pending-card .pc-ops form { margin: 0; }
@media (max-width: 700px) {
  .pending-card .pc-ops { margin-left: 0; width: 100%; }
}

/* ============================================================
   2026-09：去掉「设置分类 / 区块导航」侧栏后的单栏布局
   原先为 grid 双栏（左导航 + 右内容），导航删除后统一改为单栏铺满
   ============================================================ */
.cfg-layout, .sec-layout { display: block !important; }
.cfg-main, .sec-main { min-width: 0; }

/* ============================================================
   2026-09 收尾修正：顶栏用户区在窄屏溢出（长用户名 + 退出按钮）
   修复：允许收缩 + 文本截断，极端窄屏隐藏用户名只留退出入口
   ============================================================ */
.topbar-user { min-width: 0; max-width: 46vw; overflow: hidden; }
.topbar-user .u-name, .topbar-user b, .topbar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) {
  .topbar-user { max-width: 34vw; }
}

/* ============================================================
   2026-09 登录页品牌区（重做）
   设计取舍：
   · 去掉「浅底小方块 + 内嵌小图标」的壳 —— 这是模板化登录页最典型的形态，
     且 40px 壳里塞 20px 图标，视觉分量不足、显轻飘。
   · 改为一个大尺寸主色线性图标（44px / 1.4 描边）直接立在标题上方：
     货箱线框本身是"物资"的语义符号，不需要再套一个装饰性方框。
   · 标题放大到 23px / 700 并收紧字距 —— 让"系统名"成为这一屏唯一有重量的元素。
   · 「请登录」降为 13px 灰字、加一点字距，作为说明而非第二个标题。
   · 品牌区与表单之间加 1px 分隔线：区分「这是什么系统」与「请输入凭证」两件事，
     是结构信息而非装饰。
   · 三者纵向居中，整块与卡片中线对齐。
   ============================================================ */
.login-brand {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: auto;
  gap: 0;
  margin: 0 auto 20px !important;   /* 分隔线下留白，与 padding-bottom 对称 */
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  text-align: center !important;
}
.login-brand .login-logo {
  width: 44px; height: 44px; margin: 0 0 13px;
  background: none; border: none; box-shadow: none; border-radius: 0;
  color: var(--primary);
}
.login-brand .login-logo svg { width: 44px; height: 44px; stroke-width: 1.4; }
.login-brand h1 {
  grid-column: auto; grid-row: auto;
  font-size: 23px; font-weight: 700; letter-spacing: -.2px;
  line-height: 1.25; margin: 0; text-align: center;
}

/* ============================================================
   物资管理：已忽略条目管理弹窗（分「暂缓提示」与「永久忽略」两张卡片）
   结构：卡片 → 卡头（状态点 + 标题 + 计数徽章 + 说明）/ 条目列表 → 每行名称对 + 操作
   沿用全站设计语言：白底 + 1px 边框 + 圆角 8、灰底卡头、无渐变、数字等宽。
   ============================================================ */
.ign-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 12px;
  overflow: hidden;
}
.ign-card-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px;
  background: #f7f9fb;
  border-bottom: 1px solid var(--border);
}
.ign-card-head h4 { margin: 0; font-size: 13.5px; font-weight: 700; color: #1f2a37; }
.ign-card-head .muted { font-size: 12px; }
.ign-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.ign-dot.normal { background: #16549b; }
.ign-dot.perm { background: #94a3b8; }
.ign-list { display: flex; flex-direction: column; }
.ign-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f6;
}
.ign-row:last-child { border-bottom: none; }
.ign-info { flex: 1; min-width: 200px; }
.ign-pair { font-size: 13.5px; font-weight: 600; color: #1f2a37; }
.ign-meta { font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ign-empty { font-size: 12.5px; padding: 12px; margin: 0; }
@media (max-width: 560px) {
  .ign-row { align-items: flex-start; }
  .ign-row form { width: 100%; }
}

/* 合并同类物资：弱信号折叠区（名称包含/疑似错字，多数不是同一物资） */
.dup-weak { margin-top: 4px; }
.dup-weak > summary {
  cursor: pointer; font-size: 12.5px; color: var(--muted);
  padding: 7px 11px; background: #f7f9fb; border: 1px solid var(--border); border-radius: 8px;
  list-style: none;
}
.dup-weak > summary::-webkit-details-marker { display: none; }
.dup-weak > summary::before { content: '▸ '; color: var(--muted); }
.dup-weak[open] > summary::before { content: '▾ '; }
.dup-weak > summary:hover { background: #eef3f9; color: #33475f; }

/* ============================================================
   分类表（物资分类标签）：小类 / 物资数 / 操作 三列对齐
   原先「编辑」按钮放在「小类」列里跟着文字走，小类名长短不同就左右不齐；
   现在统一移到「操作」列与「删除」并排，并固定各列宽度，逐行严整对齐。
   ============================================================ */
table.cat-table { table-layout: fixed; }
table.cat-table th:nth-child(1), table.cat-table td:nth-child(1) { width: auto; }
table.cat-table th:nth-child(2), table.cat-table td:nth-child(2) {
  width: 88px; text-align: center; font-variant-numeric: tabular-nums;
}
table.cat-table th:nth-child(3), table.cat-table td:nth-child(3) {
  width: 132px; text-align: right; white-space: nowrap;
}
table.cat-table td:nth-child(1) { overflow-wrap: anywhere; }
table.cat-table td:nth-child(3) .btn { margin-left: 6px; }

/* ===== 模板内联色收敛用的语义变量 =====
   这些值原本硬编码在模板的 style="..." 里（26 处）。集中定义后，
   以后统一调色只改这里。取值与替换前完全一致，视觉零变化。 */
:root {
  --ink-1: #1f2a37;        /* 卡片内标题 */
  --ink-2: #33475f;        /* 次级标题 */
  --ink-3: #334155;        /* 正文强灰 */
  --gray-4: #94a3b8;       /* 最弱灰（页脚等） */
  --soft-bg: #f8fafc;      /* 浅底块 */
  --soft-bg-2: #f7f9fb;    /* 浅底块（另一档） */
  --soft-line: #dde3ea;    /* 浅分隔线 */
  --soft-line-2: #e2e8f0;  /* 浅分隔线（另一档） */
  --c-red: #dc2626;        /* 警示红（差异、删除） */
  --c-red-dark: #b91c1c;   /* 深警示红 */
  --c-green: #059669;      /* 正向绿（盘盈） */
  --c-amber: #b45309;      /* 提醒橙 */
  --c-amber-bg: #fffbeb;   /* 提醒橙底 */
  --c-amber-line: #fde68a; /* 提醒橙边 */
  --c-violet: #7c3aed;     /* 紫（应急用途默认色） */
  --c-indigo: #4f46e5;     /* 靛蓝（微标） */
  --c-pink-bg: #fecaca;    /* 浅红底 */
}

/* 折叠侧栏的菜单名提示条：由 base.html 脚本创建（position:fixed，不产生滚动条） */
#nav-tip {
  position: fixed;
  z-index: 60;
  padding: 5px 10px;
  background: #0e1721;
  color: #fff;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
#nav-tip.on { opacity: 1; }

/* 库存查询页：固定资产规格行下面的「逐台资产」子行
   （把「在用 3」拆开显示每台的编号/使用人/部门/状态/位置） */
tr.asset-sub td {
  background: #fafbfc;
  font-size: 12.5px;
  color: #475569;
  padding-top: 4px;
  padding-bottom: 4px;
}
tr.asset-sub:hover td { background: #f4f7fa; }

/* 库存查询：固定资产的可点击展开入口（默认收起，点开看逐台明细） */
tr.asset-parent { cursor: pointer; }
tr.asset-parent:hover td { background: #f4f7fa; }
tr.asset-parent .caret {
  width: 13px; height: 13px; color: #94a3b8;
  vertical-align: -2px; margin-left: 2px;
  transition: transform .15s ease;
}
tr.asset-parent.open .caret { transform: rotate(90deg); color: #16549b; }
tr.asset-parent:hover .caret { color: #16549b; }
tr.asset-parent:focus-visible { outline: 2px solid #16549b; outline-offset: -2px; }


/* ── 库存查询表格：固定列宽 ───────────────────────────────────
   物资名里存在 70+ 字的超长条目（如「会议桌（规格:4500*1600*760mm;基材…）」），
   table-layout:auto 会按最长内容分配列宽，把物资列撑到 800px+、把分类列挤到折行。
   这里改为 fixed + colgroup 精确定宽：物资列 330px（超长名换行），分类列 140px（一行放下
   「办公物资 / 固定资产」）。 */
table.inv-tbl { table-layout: fixed; width: 100%; min-width: 1000px; }
table.inv-tbl th, table.inv-tbl td { overflow-wrap: break-word; }
table.inv-tbl th:nth-child(1), table.inv-tbl td:nth-child(1) { text-align: left; }
/* 物资名最长 2 行，超出省略（悬停 title 看全名）—— 避免一条 70 字的名字把整行撑成 4 行高 */
table.inv-tbl td.col-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}
/* 分类「办公物资 / 固定资产」、存放位置「公司 等 4 处」保持一行 */
table.inv-tbl th:nth-child(2), table.inv-tbl td:nth-child(2),
table.inv-tbl th:nth-child(8), table.inv-tbl td:nth-child(8),
table.inv-tbl th:nth-child(9), table.inv-tbl td:nth-child(9) { white-space: nowrap; }
