/* ============ WMS 全局样式 ============ */
:root {
  --primary: #1a6fb5;
  --primary-dark: #155a92;
  --bg: #f4f6f8;
  --border: #dde3e8;
  --text: #24303a;
  --muted: #7a8894;
  --danger: #c0392b;
  --ok: #1e8e5a;
  --off: #b03a2e;
  --topbar-bg: #1f2937;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  background: var(--topbar-bg);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px 24px;
  padding: 10px 24px;
  flex-wrap: wrap;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
}
.brand-sub { font-size: 14px; font-weight: 700; color: #fff; margin-left: 8px; }

.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; min-width: 420px; }
.nav a {
  color: #cbd5e1;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
  width: 80px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: #374151; color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }

.userbox { display: flex; align-items: center; gap: 12px; white-space: nowrap; margin-left: auto; }
.username { color: #e5e7eb; }

/* ---------- 布局 ---------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.page-title { font-size: 22px; margin: 0 0 16px; }
.section { margin-bottom: 28px; }
.section-title { font-size: 16px; margin: 0 0 12px; color: var(--primary-dark); }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 16px; }

/* ---------- 表单 ---------- */
.field {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.field:focus { outline: none; border-color: var(--primary); }

.field-label { display: block; margin: 14px 0 6px; font-weight: 600; }
.req { color: var(--danger); }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  max-width: 640px;
}
.card.center { text-align: center; margin: 40px auto; }

.form-row.readonly {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: #f8fafc;
  border: 1px dashed var(--border); border-radius: 6px;
}
.readonly-value { font-family: inherit; font-weight: 600; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.checkbox-row input { width: 16px; height: 16px; }

.form-actions { margin-top: 20px; display: flex; gap: 12px; }

/* ---------- 用户表单：四列网格（新增/编辑用户页） ---------- */
.card-wide { max-width: none; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 20px;
}
.form-item { display: flex; flex-direction: column; }
.form-item .field-label { margin: 0 0 6px; }
.form-item-full { grid-column: 1 / -1; }
.form-item-full.checkbox-row { margin-top: 0; }
.form-item-full.form-actions { margin-top: 0; }

/* ---------- 顶部工具栏 ---------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search-form { display: flex; gap: 8px; flex: 1; max-width: 460px; }
.search-form .btn { flex-shrink: 0; }

/* 仓库页：层级标签（仓/库/区）不压缩，搜索框加宽避免与标签重叠、placeholder 完整显示 */
.warehouse-page .search-form { max-width: 600px; }
.warehouse-page .search-form .type-select { flex-shrink: 0; width: auto; height: auto; }
.warehouse-page .search-form input.field[type=text] { flex: 1 1 auto; min-width: 240px; }

/* 工具栏右侧按钮组 + 数据展示列显隐面板 */
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.colvis-wrap { position: relative; }
.batch-wrap { position: relative; }
.batch-item {
  display: block; padding: 8px 10px; text-decoration: none; color: var(--text);
  border-radius: 6px; cursor: pointer; font-size: 14px; white-space: nowrap;
}
.batch-item:hover { background: var(--bg); }
.batch-item-danger { color: #dc2626; }
.colvis-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 30, 45, 0.12);
  min-width: 170px;
  padding: 10px 12px;
}
.colvis-panel.open { display: block; }
.colvis-panel label {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; cursor: pointer; font-size: 14px;
}
.colvis-panel input { width: 15px; height: 15px; cursor: pointer; }

.filter-bar {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 14px; margin-bottom: 10px; flex-wrap: wrap;
}
.filter-label { color: var(--text); white-space: nowrap; line-height: 1.4; }
.filter-bar .field {
  width: 120px; min-width: 120px; padding: 5px 10px; height: 34px;
  box-sizing: border-box; line-height: 1.4; overflow: visible;
}
.filter-bar .multi-select { align-self: center; }
.filter-bar .multi-select .ms-btn {
  height: 34px; line-height: 1.4; box-sizing: border-box;
  display: inline-flex; align-items: center; white-space: nowrap;
}

.filter-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  background: #eaf2fa; color: var(--primary-dark);
  border-radius: 20px; padding: 4px 12px; font-size: 13px;
}
.tag-clear { text-decoration: none; background: #f1f3f5; color: var(--muted); }

/* ---------- 用户管理页：宽屏布局 ---------- */
.container--wide { max-width: 100%; padding-bottom: 48px; }
.users-page .search-form { max-width: 552px; }        /* 搜索框宽：368 × 1.5 */

/* 表格横向滚动：列多时左右滑动 */
.table-wrap { overflow-x: auto; }
.users-page .data-table { min-width: 1700px; }

/* ---------- 数据表 ---------- */
.data-table {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.data-table th {
  background: #f8fafc;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #eef1f4;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f7fafc; }
.col-op { width: 80px; min-width: 80px; position: relative; }
/* 勾选框列：固定 56px 标准表格单元格布局（不依赖 flex，避免不同浏览器下列宽被拉成大白块）；
   勾选框居中，展开箭头绝对定位悬浮在勾选框左侧固定间距 */
.col-check {
  width: 56px; min-width: 56px; max-width: 56px;
  text-align: center;
  white-space: nowrap;
  position: relative;
}
.col-check input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
/* 「包含权限项 / 权限组」列：限制列宽（约缩短 20%），超长省略号，悬停 title 显示全文 */
.data-table td.col-items,
.data-table td.col-groups {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.col-remark { max-width: 240px; color: var(--muted); }
.col-uuid { font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 30px 0 !important; }

/* 行操作键：三个横线图标（纯 CSS 绘制） */
.op-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  position: relative;
}
.op-btn::before {
  content: "";
  position: absolute;
  left: 6px; right: 6px; top: 50%;
  height: 2px;
  background: var(--text);
  box-shadow: 0 -5px 0 var(--text), 0 5px 0 var(--text);
}
.op-btn:hover { border-color: var(--primary); }

/* 操作下拉菜单 */
.op-menu {
  display: none;
  position: absolute;
  left: 36px; top: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 30, 45, 0.12);
  min-width: 110px;
  padding: 4px;
}
.op-menu.open { display: block; }

/* 最后一行菜单向上弹出，避免超出表格底部被滚动容器裁剪 */
.data-table tbody tr:last-child .op-menu {
  top: auto;
  bottom: 100%;
}
.op-item {
  display: block; width: 100%;
  padding: 8px 12px;
  border: none; background: none;
  text-align: left; font-size: 14px;
  color: var(--text); text-decoration: none;
  border-radius: 6px; cursor: pointer;
}
.op-item:hover { background: #f1f5f9; }
.op-danger { color: var(--danger); }
.op-danger:hover { background: #fdf0ee; }

/* 状态徽章 */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
}
.badge-ok { background: #e5f6ec; color: var(--ok); }
.badge-off { background: #fdeaea; color: var(--off); }

/* ---------- 首页统计卡片 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
}
.stat-count { font-size: 28px; font-weight: 700; color: var(--primary-dark); }
.stat-label { margin-top: 6px; color: var(--muted); }

/* ---------- 首页功能导航 ---------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.module-card {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 16px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.module-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(26, 111, 181, 0.12); }
.module-name { font-size: 16px; font-weight: 600; }
.module-desc { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- 登录页 ---------- */
.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 180px);
}
.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 30, 45, 0.08);
  padding: 36px 40px;
  width: 460px;
}
.login-logo {
  width: 64px;
  height: 64px;
  display: block;
  margin: 0 auto 14px;
}
.login-title { font-size: 22px; margin: 0 0 6px; text-align: center; white-space: nowrap; }
.login-sub { text-align: center; color: var(--muted); margin: 0 0 10px; }

/* ---------- 提示消息 ---------- */
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
}
.flash.success { background: #e5f6ec; color: var(--ok); border: 1px solid #c3e8d2; }
.flash.error { background: #fdeaea; color: var(--off); border: 1px solid #f5c6c0; }

/* ---------- 自定义确认弹窗（替代浏览器系统弹窗） ---------- */
.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 45, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-mask.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(15, 30, 45, 0.2);
}
.modal-text { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 弹窗标题与表单弹窗 */
.modal-title { margin: 0 0 16px; font-size: 18px; color: var(--text); }
.modal-form { max-width: 1200px; }

/* 弹窗表单：三列布局（文本框宽度较两列时明显缩短） */
.modal-form .form-grid { grid-template-columns: repeat(3, 1fr); }

/* 弹窗内的只读值：与表单控件同规格、不可编辑 */
.modal-form .form-item .readonly-value {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  font-weight: 400;
  word-break: break-all;
  display: flex;
  align-items: center;
  min-height: 40px;
}

/* 详情弹窗页脚：创建/更新信息一行四列 */
.detail-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 20px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.detail-footer .field-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.detail-footer .readonly-value { background: #fff; }

/* 详情弹窗列表 */
.detail-list { margin: 0 0 8px; }
.detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #eef1f4;
  font-size: 14px;
}
.detail-row dt { width: 90px; flex-shrink: 0; color: var(--muted); }
.detail-row dd { margin: 0; flex: 1; word-break: break-all; }
.detail-list .detail-row:last-child { border-bottom: none; }

/* 账号链接：可点击查看详情 */
.account-link { color: var(--primary); text-decoration: none; cursor: pointer; }
.account-link:hover { text-decoration: underline; }

/* 弹窗表单错误提示 */
.form-error {
  background: #fdeaea; color: var(--off);
  border: 1px solid #f5c6c0; border-radius: 6px;
  padding: 8px 12px; margin-bottom: 12px; font-size: 13px;
}

@media (max-width: 1100px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .topbar { height: auto; padding: 10px 16px; }
  .nav { order: 3; width: 100%; }
  .container { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- UUID 条形码 / 二维码弹窗 ---------- */
.uuid-link { color: var(--primary); text-decoration: none; cursor: pointer; }
.uuid-link:hover { text-decoration: underline; }
.uuid-box { max-width: 640px; }
.uuid-data-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  text-align: left;
}
.uuid-data-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 12px;
}
.uuid-code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 15px;
  color: #1f2937;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 10px 14px;
  word-break: break-all;
  text-align: left;
  flex: 1;
}
.uuid-qr-center {
  text-align: center;
  margin-bottom: 14px;
}
.uuid-barcode-bottom { margin-top: 2px; }
.uuid-barcode-bottom .barcode-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.uuid-barcode-bottom .barcode-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}
.code-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: center;
}
.barcode-wrap { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.barcode-wrap svg { display: block; width: 100%; height: auto; }
.uuid-detail-link { cursor: pointer; color: var(--primary); }
.uuid-detail-link:hover { text-decoration: underline; }
.qr-icon {
  vertical-align: -2px;
  margin-right: 5px;
  flex-shrink: 0;
}
.uuid-detail-link .qr-icon { vertical-align: -3px; }
.qrcode-wrap {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; display: inline-block;
}
.qrcode-wrap canvas, .qrcode-wrap img { display: block; margin: 0 auto; }

/* ---------- 扫码弹窗 ---------- */
.scan-box { max-width: 520px; }
.scan-viewport {
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-viewport video { width: 100%; display: block; }
.scan-status {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 10px 0 0;
}

/* ---------- 批量上传弹窗 ---------- */
.upload-box { max-width: 1100px; }
.upload-toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.upload-file-btn { cursor: pointer; }
.upload-status { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.upload-status.has-error { color: #d0342c; }
.upload-table-wrap {
  overflow: auto;
  max-height: 380px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.upload-table { width: 100%; border-collapse: collapse; }
.upload-table th, .upload-table td {
  border: 1px solid var(--border);
  padding: 4px 6px;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}
.upload-table th { background: #f1f5f9; position: sticky; top: 0; }
.col-idx { width: 36px; text-align: center; }
.upload-cell {
  width: 100%;
  min-width: 90px;
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 4px;
  font-size: 13px;
  border-radius: 4px;
}
.upload-cell:focus { outline: none; border-color: var(--primary); background: #fff; }
tr.upload-row-error { background: #fdecea; }
tr.upload-row-error .upload-cell { background: #fff0ee; }
.upload-err-cell {
  color: #d0342c;
  font-size: 12px;
  min-width: 160px;
  background: #fdecea;
}
.upload-errors { font-size: 13px; color: var(--muted); margin-top: 10px; }
.upload-errors.has-error { color: #d0342c; }

/* ---------- 权限管理 V1.3：权限组列表页 ---------- */
/* 权限等级徽章：高（红）/ 中（琥珀）/ 低（绿） */
.badge-high { background: #fdeaea; color: #d0342c; }
.badge-medium { background: #fff4e5; color: #b45309; }
.badge-low { background: #e5f6ec; color: #0a7a3d; }
/* 内置权限组徽章 */
.chip-builtin {
  display: inline-block; margin-left: 6px;
  background: var(--primary); color: #fff;
  font-size: 11px; line-height: 1; padding: 3px 7px;
  border-radius: 999px; vertical-align: middle;
}
/* 权限组行：点击整行展开/收起权限项子表（箭头悬浮在勾选框左侧，展开时旋转） */
.group-row { cursor: pointer; }
.row-arrow {
  position: absolute;
  top: 50%;
  left: calc(50% - 20.5px);
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 5px solid var(--muted);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  transition: transform .15s ease;
}
.group-row.open .row-arrow { transform: translateY(-50%) rotate(180deg); }
/* 展开的子表行 */
.sub-row { display: none; background: #f8fafc; }
.sub-row.open { display: table-row; }
.sub-cell { padding: 0 18px 14px 46px !important; }
.sub-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 0 8px;
}
.sub-actions { display: flex; align-items: center; gap: 8px; }
.sub-title { font-weight: 600; font-size: 14px; }
.sub-table { margin-bottom: 0; }
.sub-table th { background: #eef2f7; font-size: 12px; }
.sub-table td { white-space: nowrap; }

/* ---------- 产品列表：按产品类型分组，组头展开/折叠，属性以列展示 ---------- */
.products-page .type-group { margin-bottom: 14px; }
.products-page .type-group:last-child { margin-bottom: 0; }
.type-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  user-select: none;
}
.type-group-head:hover { background: #eef2f7; }
.type-arrow {
  width: 0; height: 0;
  border-top: 5px solid var(--muted);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  transition: transform .15s ease;
  flex-shrink: 0;
}
.type-group.collapsed .type-arrow { transform: rotate(-90deg); }
.type-group-name { font-weight: 600; font-size: 15px; }
.type-group-count { color: var(--muted); font-size: 13px; }
.type-group-body .data-table { border-top: none; border-radius: 0 0 10px 10px; }
.type-group.collapsed .type-group-head { border-bottom: 1px solid var(--border); border-radius: 10px; }
.type-group.collapsed .type-group-body { display: none; }
/* 属性列：不换行、超长省略号，悬停 title 显示完整值 */
.products-page .attr-col { white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
/* 操作菜单中不可用项 */
.op-item.op-disabled { color: var(--muted); cursor: not-allowed; }
/* 权限组新增/编辑弹窗：三列加宽 */
.modal-form-wide { max-width: 1400px; }
/* 权限项多选选择器 */
.item-picker {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; margin-top: 12px; background: #f8fafc;
}
.item-picker-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.item-picker-search { max-width: 320px; }
.item-picker-list { max-height: 340px; overflow: auto; }
.item-picker-module { margin-bottom: 12px; }
.item-picker-module:last-child { margin-bottom: 0; }
.item-picker-module-head {
  padding: 6px 0; border-bottom: 1px dashed var(--border); margin-bottom: 6px;
  font-weight: 600; font-size: 13px;
}
.item-picker-module-title { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.item-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 14px;
}
.item-picker-option {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer; padding: 3px 4px; border-radius: 4px;
}
.item-picker-option:hover { background: #eef2f7; }
.item-picker-option input { width: 15px; height: 15px; cursor: pointer; }
.item-picker-option-disabled { opacity: .55; cursor: not-allowed; }
.item-picker-option-disabled:hover { background: transparent; }
.item-picker-code { color: var(--muted); font-family: Consolas, monospace; font-size: 12px; }

/* 用户管理表单：权限组多选 */
.group-check-list {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; background: #f8fafc; margin: 6px 0 4px;
}
.group-check-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 999px; background: #fff;
}
.group-check-item input { width: 15px; height: 15px; cursor: pointer; }
.group-check-item.group-check-auto {
  background: #eef4ff; border-color: #bfdbfe;
}
.group-check-tag { color: var(--muted); font-size: 12px; }
.group-check-item.group-check-auto .group-check-tag { color: var(--primary); }
/* ---------- 产品管理 V1.4：产品列表 / 属性标签 / 类型标签 ---------- */
/* 页面副标题 */
.page-sub { color: var(--muted); font-size: 13px; margin: -6px 0 14px; }
/* PD Code 前的条码/二维码小图标 */
.pd-barcode-link { display: inline-flex; vertical-align: middle; margin-right: 6px; color: var(--muted); }
.pd-barcode-link:hover { color: var(--primary); }
/* 新增/编辑产品弹窗：动态属性区 */
.attr-form-block { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.attr-form-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px 18px; margin-top: 8px;
}
.attr-form-item .field { width: 100%; }
.attr-form-item.attr-full { grid-column: 1 / -1; }
/* 类型标签页卡片 */
.tpl-card {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px; background: #fff;
}
.tpl-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border);
}
.tpl-type { font-weight: 600; font-size: 15px; }
.tpl-count { font-size: 13px; }
.tpl-save { margin-left: auto; }
.tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 14px;
}
.tpl-option {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.tpl-option:hover { background: #eef2f7; }
.tpl-option input { width: 15px; height: 15px; cursor: pointer; }
.tpl-unit { color: var(--muted); font-size: 12px; }

/* ================= V1.5 升级：审核状态菜单 / 多选筛选 / 分组滑动 / 列自定义 / 序列复制 / 日志页 ================= */
/* 1. 审核状态徽章与下拉菜单 */
.badge-pending { background: #e8f3ff; color: #1677ff; }
.audit-wrap { position: relative; display: inline-block; }
.audit-btn { background: none; border: none; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.audit-menu { position: absolute; z-index: 30; top: 0; left: calc(100% + 8px); min-width: 150px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 4px; display: none; }
.audit-menu.open { display: block; }
/* 表格最右侧一行的审核菜单向左展开，避免超出表格/页面右边缘被裁剪 */
.data-table tr:last-child .audit-menu,
.data-table td:last-child .audit-menu {
  left: auto;
  right: calc(100% + 8px);
}
.audit-menu.open { display: block; }
.audit-item { display: block; padding: 7px 10px; font-size: 13px; color: var(--text); border-radius: 6px; text-decoration: none; }
.audit-item:hover { background: #eef2f7; }
.audit-danger { color: #d93025; }
.audit-danger:hover { background: #fdecea; }

/* 2. 多选筛选组件 */
.multi-select { position: relative; display: inline-block; }
.ms-btn { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; color: var(--text); }
.ms-btn:hover { border-color: var(--primary); }
.ms-arrow { margin-left: 6px; font-size: 10px; color: var(--muted); }
.ms-panel { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 190px; max-height: 260px; overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 8px; display: none; }
.ms-panel label { display: block; padding: 5px 6px; font-size: 13px; cursor: pointer; border-radius: 6px; }
.ms-panel label:hover { background: #eef2f7; }
.multi-select.open .ms-panel,
.multi-select.ms-open .ms-panel { display: block; }
.field-date { width: 132px; }

/* 3. 筛选条件标签 */
.filter-tags { margin: 10px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-block; background: #eef2f7; border-radius: 6px; padding: 3px 9px; font-size: 12px; color: #333; }
.tag-clear { color: var(--primary); text-decoration: none; }

/* 4. 日志页操作类型徽章 */
.badge-log { font-size: 12px; }
.badge-log-create { background: #e8f5e9; color: #1e8e3e; }
.badge-log-update { background: #e3f2fd; color: #1565c0; }
.badge-log-delete { background: #fdecea; color: #c62828; }
.badge-log-audit { background: #fff8e1; color: #b7791f; }
.badge-log-enable, .badge-log-disable { background: #f3e5f5; color: #6a1b9a; }
.badge-log-login, .badge-log-logout { background: #ede7f6; color: #4527a0; }
.badge-log-export { background: #e0f7fa; color: #00695c; }
.badge-log-reopen { background: #e0f2f1; color: #00695c; }

/* 5. 分组表：左右滑动（每组独立横向滚动） */
.type-group-body { overflow-x: auto; }
.type-group-body .product-table { min-width: 900px; }
.table-wrap { overflow-x: auto; }
.data-table th, .data-table td { white-space: nowrap; }

/* 6. 列宽：PD Code 优先单行、产品名称定宽省略、备注/人员/时间列放最后 */
.col-pd-code { white-space: nowrap; max-width: 320px; overflow: hidden; }
        .data-table th.col-name, .data-table td.col-name { min-width: 240px; max-width: 280px; }
        .data-table td.col-name { white-space: normal; word-break: break-word; line-height: 1.45; }
.col-remark { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.attr-col { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* 7. 序列数据：截断展示 + 点击复制 */
.attr-copy { cursor: pointer; color: var(--primary); white-space: nowrap; }
.pd-code-expand { cursor: pointer; color: var(--primary); gap: 6px; }
.pd-code-expand #d-pd-code-text { color: var(--text); flex: 1 1 auto; word-break: break-all; }
.pd-code-expand .qr-icon { flex-shrink: 0; }
.attr-copy:hover { opacity: .8; }
.copy-toast { position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%); background: rgba(0,0,0,.78); color: #fff; font-size: 13px; padding: 8px 16px; border-radius: 8px; z-index: 999; pointer-events: none; opacity: 0; transition: opacity .25s; }
.copy-toast.show { opacity: 1; }

/* 8. 动态属性表单：文本框固定高度，避免长序列撑高弹窗 */
.attr-form-grid textarea.field, .attr-form-item textarea.field { height: 64px; min-height: 0; resize: none; }

/* 9. 组头操作区：数据展示面板（列显隐 + 上移下移 + 恢复默认） */
.group-head-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.group-colvis-panel { min-width: 235px; max-height: 320px; overflow: auto; }
.colvis-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.colvis-row label { flex: 1; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.col-move-up, .col-move-down { width: 22px; height: 22px; border: 1px solid var(--border); background: #fff; border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 1; color: var(--muted); }
.col-move-up:hover, .col-move-down:hover { border-color: var(--primary); color: var(--primary); }
.colvis-reset { padding: 6px 0 2px; text-align: right; border-top: 1px solid var(--border); margin-top: 4px; }

/* 10. 批量审核子菜单 */
.batch-group-label { font-weight: 600; color: #333; cursor: default; }
.batch-group-label:hover { background: transparent; }
/* 批量审核：鼠标悬停从侧边展开二级菜单 */
.batch-group { position: relative; display: block; }
.batch-group .batch-submenu {
  position: absolute;
  left: calc(100% + 4px);
  top: -4px;
  min-width: 116px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  padding: 4px;
  z-index: 40;
  visibility: hidden;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.batch-group:hover .batch-submenu,
.batch-group:focus-within .batch-submenu {
  visibility: visible;
  opacity: 1;
  transform: translateX(0);
}
.batch-sub { padding: 8px 10px; }
.batch-item-danger { color: #d93025; }
.batch-item-danger:hover { color: #d93025; background: #fdecea; }
.op-item-danger { color: #d93025; }
.op-item-danger:hover { color: #d93025; background: #fdecea; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* 11. 详情弹窗：属性独立字段网格 */
.readonly-attr-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px 16px; border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 4px;
}
.readonly-attr-item { display: flex; flex-direction: column; gap: 3px; }
.readonly-attr-item .field-label { font-weight: 600; }
.readonly-attr-item .readonly-value { white-space: pre-wrap; word-break: break-all; }

/* 12. 全宽容器（日志/产品等宽页面）：左右延伸不留白，保留安全边框 */
.container--wide { max-width: none; padding: 24px 16px 48px; }
/* 13. V1.5 弹窗控制类：products.js 使用 .show（兼容 .open） */
.modal-mask.show { display: flex; }
/* 14. 详情弹窗：序列数据等长文本固定约 5 行高度，超出上下滑动查看 */
.attr-link { color: var(--primary); cursor: pointer; text-decoration: underline; text-decoration-style: dotted; }
.attr-link:hover { text-decoration: underline; }
.product-no-link { color: var(--primary); text-decoration: none; }
.product-no-link:hover { text-decoration: underline; }

.readonly-value.seq-readonly {
  max-height: 117px;
  overflow-y: auto;
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
  padding: 10px 14px;
  box-sizing: border-box;
  line-height: 1.5;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #2c3e50;
}

/* ================= 全站分页组件 ================= */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
  font-size: 13px;
  color: var(--text);
}
.pagination-info { color: var(--muted); margin-right: 8px; }
.pagination-num, .pagination a {
  display: inline-block;
  min-width: 30px;
  padding: 5px 9px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.pagination-num:hover, .pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination-num.current {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  cursor: default;
}
.pagination-gap { color: var(--muted); padding: 0 2px; }
/* 每页条数下拉 */
.page-size-box { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.page-size-label { color: var(--muted); }
.page-size-select {
  height: 28px; padding: 0 8px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text); font-size: 13px;
}
.page-size-select:focus { border-color: var(--primary); outline: none; }
.pagination .disabled {
  color: #b6c0c9;
  cursor: not-allowed;
  background: #f6f8fa;
  border-color: var(--border);
}


/* ================= 产品类型分区 Tab ================= */
.type-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}
.type-tab {
  display: inline-block;
  padding: 7px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: all .15s ease;
}
.type-tab:hover { border-color: var(--primary); color: var(--primary); }
.type-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.type-select {
  margin-right: 8px;
  flex-shrink: 0;
}
.type-select:not(select) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* select 型类型下拉：保持原生渲染，行高正常（避免文字上下被裁剪） */
select.type-select.field {
  display: inline-block;
  width: auto;
  min-width: 130px;
  height: 38px;
  line-height: 1.4;
  padding: 8px 12px;
}
.type-select .type-tab { cursor: pointer; padding: 7px 16px; }
.audit-badge { cursor: pointer; position: relative; user-select: none; }


/* ================= 仓库管理：三级库（仓/库/区） ================= */
.wh-level1 {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: #f7f9fb;
  border-bottom: 1px solid var(--border); font-size: 15px;
  flex-wrap: wrap;
}
.wh-level2-wrap { padding: 8px 12px 12px; }
.wh-level2 {
  margin: 8px 0 0; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.wh-level3-wrap {
  width: 100%; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.wh-bin { font-size: 13px; color: var(--text); }
.wh-badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 12px; background: #e8f3ff; color: #1677ff; font-weight: 600;
}
.wh-badge--area { background: #e5f6ec; color: #0a7a3d; }
.wh-badge--bin { background: #fff4e5; color: #b45309; }
.wh-actions { margin-left: auto; }
.wh-empty { padding: 8px 10px; font-size: 13px; }
.wh-level2 .wh-empty { border: 0; padding: 4px 0; }

/* ================= 进销存：入库表单 ================= */
.radio-line { display: flex; align-items: center; gap: 6px; margin: 2px 0; font-size: 14px; }
.pos-cascader { display: flex; gap: 8px; }
.pos-cascader select { flex: 1; }

/* ================= 库存查询 ================= */
.stock-dist { white-space: nowrap; }
.card-title { margin: 0 0 10px; font-size: 15px; color: var(--text); }


/* ================= 产品管理：工具栏类型单选 ================= */
.type-select-wrap { display: inline-flex; align-items: center; gap: 6px; }
.type-select-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.type-select { width: 128px; height: 34px; }

/* 列顺序面板（工具栏"数据展示"，带 ↑↓ 按钮） */
.colvis-panel--order { min-width: 260px; max-height: 380px; overflow: auto; padding: 10px; }

/* ================= 产品管理：类型单选（重要且突出，覆盖旧样式） ================= */
.products-page .search-form { max-width: 720px; }   /* 不为类型下拉压缩搜索框 */
.products-page .search-form input.field,
.warehouse-page .search-form input.field {
  flex: 0 0 260px;
  width: 260px;
  min-width: 260px;
}
.products-page .type-select {
  width: 180px;
  height: 34px;
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.products-page .type-select:hover {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(26, 111, 181, .15);
}
.products-page .type-select:focus {
  outline: none;
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(26, 111, 181, .28);
}

/* 类型下拉：禁止 flex 收缩，保证选项文本完整显示（Linear Plasmid 等长选项） */
.products-page .type-select { flex-shrink: 0; width: 200px; }

/* 无 admin_item 权限：隐藏"字段排序"（↑↓），仅保留列显隐 */
.colvis-panel--readonly .col-move-up,
.colvis-panel--readonly .col-move-down { display: none; }
.colvis-panel--readonly .colvis-row { justify-content: flex-start; }
.colvis-panel--readonly .colvis-reset { margin-top: 8px; display: flex; gap: 8px; }

/* ================= 序列检索弹窗 ================= */
.seq-search-box { width: 1120px; max-width: 95vw; }
.seq-search-input { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.seq-search-input .field { flex: 1; min-width: 0; }
.seq-search-count { margin: 6px 0 8px; }
.seq-search-results {
  max-height: 320px; min-height: 120px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 10px;
}
.seq-search-results .data-table { border: none; margin: 0; }
.seq-search-results .data-table thead th { position: sticky; top: 0; background: #f4f6f9; z-index: 1; }
