/* =============================================================================
   智仓仓储作业管理系统 · 后台控制台设计系统
   -----------------------------------------------------------------------------
   参考体系：字节跳动（飞书/火山引擎）紧凑高效 + 阿里云控制台专业严谨 + 鸿蒙组件感
   核心气质：紧凑、克制、专业、高信息密度
   字体：全站强制宋体，靠「字号阶梯 + 字重 + 行高」建立层次
   ============================================================================= */

:root {
  /* ---------- 中性色（占比 90%） ---------- */
  --c-bg-page:      #F5F7FA;
  --c-bg-card:      #FFFFFF;
  --c-bg-sidebar:   #FFFFFF;
  --c-bg-hover:     #F2F3F5;
  --c-bg-active:    #E8F0FE;
  --c-bg-thead:     #F7F8FA;
  --c-bg-mask:      rgba(0, 0, 0, .45);
  --c-bg-sunken:    #FAFAFB;

  --c-border:        #E5E6EB;
  --c-border-strong: #D9D9D9;
  --c-border-focus:  #1664FF;

  --c-text-1:        #1D2129;
  --c-text-2:        #4E5969;
  --c-text-3:        #86909C;
  --c-text-disabled: #C9CDD4;

  /* ---------- 强调色（占比 < 5%） ---------- */
  --c-primary:        #1664FF;
  --c-primary-hover:  #4080FF;
  --c-primary-active: #0E42D2;
  --c-primary-light:  #E8F0FE;

  /* ---------- 语义色 ---------- */
  --c-success: #00B42A;
  --c-warning: #FF7D00;
  --c-danger:  #F53F3F;
  --c-info:    #86909C;
  --c-success-light: #E8FFEA;
  --c-warning-light: #FFF7E8;
  --c-danger-light:  #FFECE8;

  /* ---------- 图表色序 ---------- */
  --c-chart-1: #1664FF; --c-chart-2: #00B42A; --c-chart-3: #FF7D00;
  --c-chart-4: #722ED1; --c-chart-5: #14C9C9; --c-chart-6: #F53F3F;

  /* ---------- 圆角与阴影 ---------- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, .06);
  --shadow-pop:  0 6px 24px rgba(0, 0, 0, .12);

  /* ---------- 字号阶梯（只用这 5 档） ---------- */
  --fs-1: 12px;  /* 辅助说明、标签、时间戳 */
  --fs-2: 14px;  /* 次级文本、表头、按钮、菜单 */
  --fs-3: 16px;  /* 正文、表格内容、表单值 */
  --fs-4: 20px;  /* 卡片标题、弹窗标题 */
  --fs-5: 24px;  /* 页面主标题、大屏核心数字 */

  /* ---------- 尺寸 ---------- */
  --h-topbar: 48px;
  --h-tabsbar: 36px;
  --w-sidebar: 200px;
  --w-sidebar-collapsed: 64px;
  --h-row: 48px;
  --h-control: 32px;

  --font: "SimSun", "Songti SC", "Song", serif;
}

/* ============================ 暗黑模式 ============================ */
html[data-theme="dark"] {
  --c-bg-page:      #17171A;
  --c-bg-card:      #232324;
  --c-bg-sidebar:   #1D1D1F;
  --c-bg-hover:     #2E2E30;
  --c-bg-active:    #1E2A44;
  --c-bg-thead:     #2A2A2C;
  --c-bg-sunken:    #1B1B1D;

  --c-border:        #333335;
  --c-border-strong: #3D3D40;

  --c-text-1:        #F7F8FA;
  --c-text-2:        #C9CDD4;
  --c-text-3:        #86909C;
  --c-text-disabled: #4E5969;

  --c-primary:        #4080FF;
  --c-primary-hover:  #5A93FF;
  --c-primary-active: #1664FF;
  --c-primary-light:  #1E2A44;

  --c-success-light: #16301C;
  --c-warning-light: #33260F;
  --c-danger-light:  #3A1D1B;

  --shadow-card: 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-pop:  0 6px 24px rgba(0, 0, 0, .5);
}

/* ============================ 基础重置 ============================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: var(--fs-3);
  line-height: 1.75;
  color: var(--c-text-1);
  background: var(--c-bg-page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.5; }
h1 { font-size: var(--fs-5); }
h2 { font-size: var(--fs-4); }
h3 { font-size: var(--fs-3); }

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-hover); }

button, input, select, textarea { font-family: var(--font); font-size: var(--fs-3); }

/* 滚动条：默认透明，悬停才显形（6px） */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
*:hover::-webkit-scrollbar-thumb { background: var(--c-text-disabled); }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); }

/* 数字类统一等宽，避免跳动 */
.num { font-variant-numeric: tabular-nums; }

/* ============================ 应用骨架 ============================ */

.app { display: flex; height: 100vh; overflow: hidden; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--w-sidebar);
  flex: 0 0 var(--w-sidebar);
  background: var(--c-bg-sidebar);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  transition: width .2s ease, flex-basis .2s ease;
  overflow: hidden;
}
.app.collapsed .sidebar { width: var(--w-sidebar-collapsed); flex-basis: var(--w-sidebar-collapsed); }

.logo {
  height: var(--h-topbar);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--c-border);
  flex: 0 0 var(--h-topbar);
  overflow: hidden;
  white-space: nowrap;
}
.logo-mark {
  width: 26px; height: 26px; flex: 0 0 26px;
  border-radius: var(--radius-sm);
  background: var(--c-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-2); font-weight: 700;
}
.logo-text { font-size: var(--fs-3); font-weight: 700; color: var(--c-text-1); }
.logo-sub { font-size: var(--fs-1); color: var(--c-text-3); }
.app.collapsed .logo-text, .app.collapsed .logo-sub { display: none; }

.menu { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.menu-group-label {
  padding: 12px 16px 4px;
  font-size: var(--fs-1);
  color: var(--c-text-3);
  white-space: nowrap;
}
.app.collapsed .menu-group-label { display: none; }

.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  font-size: var(--fs-2);
  line-height: 1.5;
  color: var(--c-text-2);
  cursor: pointer;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.menu-item:hover { background: var(--c-bg-hover); color: var(--c-text-1); }
.menu-item.is-active {
  background: var(--c-bg-active);
  color: var(--c-primary);
  font-weight: 700;
}
.menu-item.is-active::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 2px 2px 0;
  background: var(--c-primary);
}
.menu-item .icon { flex: 0 0 16px; width: 16px; height: 16px; }
.menu-item .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item .arrow { flex: 0 0 14px; transition: transform .2s ease; }
.menu-item.is-open .arrow { transform: rotate(90deg); }
.app.collapsed .menu-item .label,
.app.collapsed .menu-item .arrow { display: none; }
.app.collapsed .menu-item { justify-content: center; padding: 0; }

.submenu { overflow: hidden; max-height: 0; transition: max-height .2s ease; }
.submenu.is-open { max-height: 480px; }
.app.collapsed .submenu { display: none; }
.submenu .menu-item { height: 36px; padding-left: 40px; font-size: var(--fs-2); }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--h-topbar);
  flex: 0 0 var(--h-topbar);
  background: var(--c-bg-card);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 20;
}
.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; border-radius: var(--radius-sm);
  color: var(--c-text-2); cursor: pointer;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--c-bg-hover); color: var(--c-text-1); }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-2); color: var(--c-text-3); }
.breadcrumb .sep { color: var(--c-text-disabled); }
.breadcrumb .cur { color: var(--c-text-1); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
}
.user-chip:hover { background: var(--c-bg-hover); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--c-primary-light); color: var(--c-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-1); font-weight: 700;
}
.role-tag {
  font-size: var(--fs-1);
  color: var(--c-text-2);
  background: var(--c-bg-sunken);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  line-height: 1.35;
}

/* ---------- 多页签 ---------- */
.tabsbar {
  height: var(--h-tabsbar);
  flex: 0 0 var(--h-tabsbar);
  background: var(--c-bg-card);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
}
.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px;
  font-size: var(--fs-2);
  color: var(--c-text-2);
  border-right: 1px solid var(--c-border);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  background: none; border-top: none; border-left: none; border-bottom: none;
}
.tab:hover { background: var(--c-bg-hover); }
.tab.is-active { color: var(--c-primary); font-weight: 700; background: var(--c-bg-card); }
.tab.is-active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--c-primary);
}
.tab .close { width: 14px; height: 14px; opacity: .5; }
.tab .close:hover { opacity: 1; }

/* ---------- 内容区 ---------- */
.content { flex: 1; overflow-y: auto; padding: 16px; background: var(--c-bg-page); }
.page-head { margin-bottom: 16px; display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: var(--fs-4); font-weight: 700; }
.page-desc { font-size: var(--fs-1); color: var(--c-text-3); margin-top: 2px; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; }

/* ============================ 卡片 ============================ */
.card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.card.radius-lg { border-radius: var(--radius-lg); }
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 8px;
}
.card-title { font-size: var(--fs-3); font-weight: 700; line-height: 1.5; }
.card-title-sub { font-size: var(--fs-1); color: var(--c-text-3); font-weight: 400; margin-left: 8px; }
.card-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px; }
.card-body.tight { padding: 12px 16px; }

/* ============================ 统计卡片 ============================ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1280px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.stat-label { font-size: var(--fs-2); color: var(--c-text-2); display: flex; align-items: center; gap: 6px; }
.stat-label .icon { width: 14px; height: 14px; color: var(--c-text-3); }
.stat-value {
  font-size: var(--fs-5);
  font-weight: 700;
  line-height: 1.2;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.stat-unit { font-size: var(--fs-2); font-weight: 400; color: var(--c-text-3); margin-left: 4px; }
.stat-foot { margin-top: 6px; font-size: var(--fs-1); color: var(--c-text-3); display: flex; align-items: center; gap: 6px; }
.stat-up   { color: var(--c-danger); }   /* 库存语境：增长用暖色，非财务色 */
.stat-down { color: var(--c-success); }
.stat-bar { height: 4px; border-radius: 2px; background: var(--c-bg-hover); margin-top: 10px; overflow: hidden; }
.stat-bar > i { display: block; height: 100%; background: var(--c-primary); border-radius: 2px; transition: width .4s ease; }

/* ============================ 按钮 ============================ */
.btn {
  height: var(--h-control);
  padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: var(--fs-2);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border-strong);
  background: var(--c-bg-card);
  color: var(--c-text-1);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .06s ease;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn:active { transform: scale(.98); }
.btn .icon { width: 14px; height: 14px; }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); color: #fff; }
.btn-primary:active { background: var(--c-primary-active); }
.btn-danger { color: var(--c-danger); border-color: var(--c-danger); background: transparent; }
.btn-danger:hover { background: var(--c-danger); color: #fff; border-color: var(--c-danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--c-text-2); }
.btn-ghost:hover { background: var(--c-bg-hover); color: var(--c-text-1); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-1); }
.btn[disabled], .btn.is-loading { opacity: .5; cursor: not-allowed; }
.btn.is-loading { pointer-events: none; }

/* 文字型行内操作按钮 */
.link-btn {
  border: none; background: none; padding: 0 4px;
  font-size: var(--fs-2); color: var(--c-primary); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--c-danger); }
.link-btn[disabled] { color: var(--c-text-disabled); cursor: not-allowed; text-decoration: none; }

/* 权限不足：置灰而非隐藏 */
.link-btn.no-perm { color: var(--c-text-disabled); cursor: not-allowed; text-decoration: none; }

.spinner {
  width: 12px; height: 12px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.dark { border-color: var(--c-border); border-top-color: var(--c-primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ 表单 ============================ */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: var(--fs-1); color: var(--c-text-2); line-height: 1.5; }
.field.req > label::before { content: '*'; color: var(--c-danger); margin-right: 2px; }

.input, .select, .textarea {
  height: var(--h-control);
  padding: 0 10px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-md);
  background: var(--c-bg-card);
  color: var(--c-text-1);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  min-width: 0;
}
.textarea { height: auto; padding: 6px 10px; line-height: 1.75; resize: vertical; min-height: 72px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-text-3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--c-border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-primary) 12%, transparent);
}
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--c-bg-sunken); color: var(--c-text-3); cursor: not-allowed; }
.input.err, .select.err, .textarea.err { border-color: var(--c-danger); }
.field-error { font-size: var(--fs-1); color: var(--c-danger); line-height: 1.5; min-height: 16px; }
.field-hint { font-size: var(--fs-1); color: var(--c-text-3); line-height: 1.5; }

.search-input { position: relative; display: inline-flex; align-items: center; }
.search-input .icon { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--c-text-3); pointer-events: none; }
.search-input .input { padding-left: 30px; width: 220px; }

/* 表单（抽屉/弹窗内） */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-item { display: flex; gap: 12px; align-items: flex-start; }
.form-item > label {
  flex: 0 0 96px;
  text-align: right;
  font-size: var(--fs-2);
  color: var(--c-text-2);
  line-height: var(--h-control);
}
.form-item.req > label::before { content: '*'; color: var(--c-danger); margin-right: 2px; }
.form-item > .ctrl { flex: 1; min-width: 0; }
.form-item .input, .form-item .select, .form-item .textarea { width: 100%; }
.form-footer-note { font-size: var(--fs-1); color: var(--c-text-3); }

/* ============================ 表格 ============================ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-3); }
.table thead th {
  height: 40px;
  padding: 0 12px;
  background: var(--c-bg-thead);
  font-size: var(--fs-2);
  font-weight: 700;
  color: var(--c-text-2);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 2;
}
.table thead th.sortable { cursor: pointer; user-select: none; }
.table thead th.sortable:hover { color: var(--c-text-1); }
.table thead th .sort-mark { color: var(--c-text-disabled); margin-left: 4px; font-size: 10px; }
.table thead th.sorted .sort-mark { color: var(--c-primary); }
.table tbody td {
  height: var(--h-row);
  padding: 0 12px;
  color: var(--c-text-1);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--c-bg-hover); }
.table tbody tr.is-selected { background: var(--c-bg-active); }
.table tbody tr.is-selected:hover { background: var(--c-bg-active); }
.table td.mono { font-variant-numeric: tabular-nums; }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.table .col-actions { white-space: nowrap; text-align: right; }
.table .cell-2line { display: flex; flex-direction: column; line-height: 1.4; padding: 6px 0; }
.table .cell-2line .s { font-size: var(--fs-1); color: var(--c-text-3); }
.table .num { font-variant-numeric: tabular-nums; }

.table-empty, .table-loading { padding: 0; }
.checkbox { width: 14px; height: 14px; accent-color: var(--c-primary); cursor: pointer; }

/* 批量操作条 */
.bulk-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  background: var(--c-primary-light);
  border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-2);
}
.bulk-bar .count { font-weight: 700; color: var(--c-primary); }
.bulk-bar .actions { margin-left: auto; display: flex; gap: 8px; }

/* ============================ 标签 ============================ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-1);
  line-height: 1;
  background: var(--c-bg-sunken);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  white-space: nowrap;
}
.tag.primary { background: var(--c-primary-light); border-color: transparent; color: var(--c-primary); }
.tag.success { background: var(--c-success-light); border-color: transparent; color: var(--c-success); }
.tag.warning { background: var(--c-warning-light); border-color: transparent; color: var(--c-warning); }
.tag.danger  { background: var(--c-danger-light);  border-color: transparent; color: var(--c-danger); }
.tag.dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* 差异标红：盘点差异行的整行高亮 */
.row-diff { background: var(--c-danger-light) !important; }
.row-diff:hover { background: var(--c-danger-light) !important; }
.diff-up   { color: var(--c-danger); font-weight: 700; }
.diff-down { color: var(--c-success); font-weight: 700; }
.diff-zero { color: var(--c-text-3); }

/* 货位编码：等宽感，便于扫读 */
.loc-code {
  font-family: "Consolas", "Courier New", var(--font);
  font-size: var(--fs-2);
  background: var(--c-bg-sunken);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  white-space: nowrap;
}
.loc-code.big {
  font-size: var(--fs-3);
  padding: 3px 8px;
  background: var(--c-primary-light);
  border-color: transparent;
  color: var(--c-primary);
  font-weight: 700;
}

/* ============================ 分页 ============================ */
.pagination {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  font-size: var(--fs-2);
  color: var(--c-text-2);
  flex-wrap: wrap;
}
.pagination .total { margin-right: auto; }
.page-btn {
  min-width: 28px; height: 28px;
  padding: 0 6px;
  border: 1px solid var(--c-border-strong);
  background: var(--c-bg-card);
  border-radius: var(--radius-sm);
  color: var(--c-text-1);
  cursor: pointer;
  font-size: var(--fs-2);
}
.page-btn:hover:not([disabled]) { border-color: var(--c-primary); color: var(--c-primary); }
.page-btn.is-active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.page-btn[disabled] { color: var(--c-text-disabled); cursor: not-allowed; }
.page-size { height: 28px; padding: 0 4px; }
.page-jump { width: 52px; height: 28px; text-align: center; }

/* ============================ 四态：空 / 错 / 加载 ============================ */
.state-box {
  padding: 56px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.state-box .state-icon { width: 56px; height: 56px; color: var(--c-text-disabled); margin-bottom: 4px; }
.state-box .state-title { font-size: var(--fs-3); color: var(--c-text-1); font-weight: 700; }
.state-box .state-desc { font-size: var(--fs-2); color: var(--c-text-3); max-width: 420px; line-height: 1.75; }
.state-box .state-code { font-size: var(--fs-1); color: var(--c-text-3); font-variant-numeric: tabular-nums; }
.state-box .state-actions { margin-top: 8px; display: flex; gap: 8px; }
.state-box.error .state-icon { color: var(--c-danger); }

/* 骨架屏 */
.skeleton-row { display: flex; gap: 12px; padding: 14px 12px; border-bottom: 1px solid var(--c-border); }
.sk {
  height: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--c-bg-hover) 25%, var(--c-bg-sunken) 37%, var(--c-bg-hover) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  flex: 1;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 顶部细进度条 */
.top-progress {
  position: absolute; left: 0; top: 0; height: 2px;
  background: var(--c-primary);
  transition: width .3s ease;
  z-index: 30;
}

/* ============================ Toast ============================ */
.toast-wrap {
  position: fixed; top: 60px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
}
.toast {
  min-width: 200px; max-width: 360px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-2);
  display: flex; align-items: flex-start; gap: 8px;
  animation: toast-in .22s cubic-bezier(.4, 0, .2, 1);
}
.toast .icon { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 3px; }
.toast.success .icon { color: var(--c-success); }
.toast.error .icon { color: var(--c-danger); }
.toast.warning .icon { color: var(--c-warning); }
.toast.info .icon { color: var(--c-primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ============================ 弹窗 / 抽屉 ============================ */
.mask {
  position: fixed; inset: 0;
  background: var(--c-bg-mask);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fade-in .18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 520px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: var(--c-bg-card);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modal-in .22s cubic-bezier(.4, 0, .2, 1);
  box-shadow: var(--shadow-pop);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 16px 20px 12px; display: flex; align-items: flex-start; gap: 8px; }
.modal-title { font-size: var(--fs-4); font-weight: 700; flex: 1; }
.modal-body { padding: 0 20px 16px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 12px 20px; display: flex; gap: 8px; align-items: center;
  border-top: 1px solid var(--c-border);
}
.modal-foot .left { margin-right: auto; }

/* 抽屉 */
.mask.drawer-mask { justify-content: flex-end; align-items: stretch; }
.drawer {
  width: 560px; max-width: 92vw;
  background: var(--c-bg-card);
  display: flex; flex-direction: column;
  animation: drawer-in .24s cubic-bezier(.4, 0, .2, 1);
}
.drawer.narrow { width: 480px; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; gap: 8px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--c-border); display: flex; gap: 8px; }

/* 确认框 */
.confirm-body { display: flex; gap: 12px; padding: 0 20px 16px; }
.confirm-icon { width: 20px; height: 20px; color: var(--c-warning); flex: 0 0 20px; margin-top: 4px; }
.confirm-text { font-size: var(--fs-3); line-height: 1.75; color: var(--c-text-1); }
.confirm-sub { font-size: var(--fs-2); color: var(--c-text-3); margin-top: 6px; line-height: 1.75; }

/* ============================ 描述列表 ============================ */
.desc-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
.desc-list.cols-3 { grid-template-columns: repeat(3, 1fr); }
.desc-item { display: flex; flex-direction: column; gap: 2px; }
.desc-item .k { font-size: var(--fs-1); color: var(--c-text-3); }
.desc-item .v { font-size: var(--fs-3); color: var(--c-text-1); word-break: break-all; }

/* ============================ 图表容器 ============================ */
.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 1100px) { .chart-row { grid-template-columns: 1fr; } }
.chart { width: 100%; height: 280px; }
.chart.sm { height: 240px; }

/* ============================ 登录页 ============================ */
.login-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--c-bg-page);
  padding: 24px;
}
.login-card {
  width: 400px; max-width: 100%;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.login-brand .logo-mark { width: 32px; height: 32px; flex-basis: 32px; font-size: var(--fs-3); }
.login-title { font-size: var(--fs-4); font-weight: 700; }
.login-sub { font-size: var(--fs-2); color: var(--c-text-3); margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .input { width: 100%; height: 36px; }

/* ---------- 双登录方式：验证码 / 密码 + 图形验证码 ---------- */
.login-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 1px solid var(--c-border);
}
.login-tab {
  position: relative; padding: 8px 14px; margin-bottom: -1px;
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--font); font-size: var(--fs-3); color: var(--c-text-3);
  border-bottom: 2px solid transparent; transition: color .15s ease, border-color .15s ease;
}
.login-tab:hover { color: var(--c-text-1); }
.login-tab.is-active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 700; }

.login-pane { display: none; flex-direction: column; gap: 16px; }
.login-pane.is-active { display: flex; }
.login-pane .input { width: 100%; height: 36px; }

/* 输入框 + 操作按钮同行（验证码 / 图形验证码） */
.login-row { display: flex; gap: 8px; align-items: stretch; }
.login-row .input { flex: 1; min-width: 0; }

.login-code-btn {
  flex: none; width: 108px; height: 36px; padding: 0 8px;
  font-size: var(--fs-2); white-space: nowrap;
}
.login-code-btn[disabled] { cursor: not-allowed; opacity: .6; }

.login-captcha {
  flex: none; width: 106px; height: 36px; padding: 0;
  border: 1px solid var(--c-border-strong); border-radius: var(--radius-md);
  background: var(--c-bg-card); cursor: pointer; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.login-captcha:hover { border-color: var(--c-text-3); }
.login-captcha img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* 联调验证码提示：空内容时不占位 */
.login-devcode {
  margin-top: 6px; font-size: var(--fs-1); color: var(--c-text-3);
  font-family: var(--font); word-break: break-all;
}
.login-devcode:empty { display: none; }
.login-err { margin-top: 16px; min-height: 20px; font-size: var(--fs-2); color: var(--c-danger); }
.login-tip {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--c-border);
  font-size: var(--fs-1); color: var(--c-text-3); line-height: 1.75;
}

/* ============================ 杂项 ============================ */
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-2 { color: var(--c-text-2); }
.text-3 { color: var(--c-text-3); }
.fs-1 { font-size: var(--fs-1); }
.fs-2 { font-size: var(--fs-2); }
.strong { font-weight: 700; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--c-border); margin: 16px 0; }

/* 尊重系统「减少动态效果」偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =============================================================================
   仓库切换器（顶栏）
   -----------------------------------------------------------------------------
   · 绑定单仓的账号：只显示仓名，不可点（title 说明原因）
   · 平台超管：可点，下拉列出「全部仓库 + 各仓」
   · 「全部仓库」视图用暖色高亮，提醒当前看的是汇总数据，写作业前要先切到具体仓
   ============================================================================= */
.wh-wrap { position: relative; display: flex; align-items: center; }

.wh-chip {
  display: flex; align-items: center; gap: 6px;
  height: var(--h-control); padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-bg-card);
  cursor: pointer;
  font-family: var(--font); font-size: var(--fs-2); color: var(--c-text-1);
  transition: background .15s, border-color .15s, color .15s;
}
.wh-chip:hover { background: var(--c-bg-hover); border-color: var(--c-border-strong); }
.wh-chip .wh-icon { display: flex; color: var(--c-text-3); }
.wh-chip .wh-name {
  max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wh-chip .wh-chevron { display: flex; color: var(--c-text-3); margin-left: 2px; }
.wh-chip .wh-sum {
  font-size: var(--fs-1); line-height: 1.5; padding: 0 5px;
  border-radius: 3px; background: rgba(255, 125, 0, .14); color: #B25E00;
}
.wh-chip.is-all {
  border-color: #FFD8A8; background: var(--c-warning-light); color: #B25E00;
}
.wh-chip.is-all .wh-icon, .wh-chip.is-all .wh-chevron { color: #E37318; }
.wh-chip.is-locked { cursor: default; }
.wh-chip.is-locked:hover { background: var(--c-bg-card); border-color: var(--c-border); }
.wh-chip.is-locked.is-all:hover { background: var(--c-warning-light); border-color: #FFD8A8; }

.wh-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 80;
  min-width: 252px; padding: 6px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  animation: whPopIn .14s ease-out;
}
@keyframes whPopIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.wh-pop-head {
  padding: 6px 10px 8px;
  font-size: var(--fs-1); color: var(--c-text-3);
}
.wh-pop-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; background: none; cursor: pointer;
  border-radius: var(--radius-md);
  font-family: var(--font); font-size: var(--fs-2); color: var(--c-text-1);
  text-align: left; line-height: 1.5;
}
.wh-pop-item:hover { background: var(--c-bg-hover); }
.wh-pop-item.is-active { background: var(--c-bg-active); color: var(--c-primary); font-weight: 700; }
.wh-pop-item .wh-code { font-size: var(--fs-1); color: var(--c-text-3); }
.wh-pop-item .wh-spacer { margin-left: auto; }
.wh-pop-item .wh-tag {
  font-size: var(--fs-1); line-height: 1.5; padding: 0 5px;
  border: 1px solid var(--c-border); border-radius: 3px;
  background: var(--c-bg-sunken); color: var(--c-text-2);
}
.wh-pop-item .wh-tag.is-sum { border-color: #FFD8A8; background: var(--c-warning-light); color: #B25E00; }
.wh-pop-foot {
  margin-top: 6px; padding: 8px 10px 4px;
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-1); color: var(--c-text-3); line-height: 1.7;
}

html[data-theme="dark"] .wh-chip.is-all {
  border-color: #4A3517; background: #2A2016; color: #FFB65C;
}
html[data-theme="dark"] .wh-chip.is-all .wh-icon,
html[data-theme="dark"] .wh-chip.is-all .wh-chevron { color: #FF9A2E; }
html[data-theme="dark"] .wh-chip.is-locked.is-all:hover { background: #2A2016; border-color: #4A3517; }
html[data-theme="dark"] .wh-pop-item .wh-tag.is-sum { border-color: #4A3517; background: #2A2016; color: #FFB65C; }

/* 表单内的「按仓配置」提示条 */
.wh-form-note {
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-primary);
  border-radius: var(--radius-sm);
  background: var(--c-bg-sunken);
  font-size: var(--fs-1); line-height: 1.7; color: var(--c-text-2);
}
.wh-form-note b { color: var(--c-text-1); }
.wh-form-note.is-warn {
  border-left-color: var(--c-warning);
  background: var(--c-warning-light);
  color: #B25E00;
}
html[data-theme="dark"] .wh-form-note.is-warn { background: #2A2016; color: #FFB65C; }

/* =============================================================================
   响应式 · 窗口变窄时的布局收敛
   -----------------------------------------------------------------------------
   桌面默认是「200px 侧栏 + 自适应内容」。窗口拉窄后若原样保留，会同时出现三类错乱：
     ① 侧栏占掉大半个屏，内容区只剩几百像素；
     ② 表格按内容把列一路压到极限，中文被挤成「一个字一行」的竖排；
     ③ 顶栏里的仓库/账号块换行，「超级管理员」竖成好几行。
   策略：
     · 侧栏由窄屏自动收起（见 app.js 的 mqNarrow），这里只补图标条的视觉；
     · 表格给列与整表最小宽度，溢出交给 .table-wrap 横向滚动，不再逐字换行；
     · 顶栏各块一律 nowrap，宁可截断也不竖排。
   ============================================================================= */

/* 侧栏收成 64px 图标条：只留图标，可读性靠菜单项自带的 title 提示补回 */
@media (max-width: 1180px) {
  .logo { justify-content: center; padding: 0; }
  .logo-text, .logo-sub,
  .menu-group-label,
  .menu-item .label, .menu-item .arrow { display: none; }
  .menu-item { justify-content: center; padding: 0; }
}

/* 表格：列有最小宽度、整表有最小宽度，宁可横向滚动也不要竖排中文 */
@media (max-width: 1180px) {
  .table { min-width: 720px; }
  .table th, .table td { min-width: 88px; }
  .content { padding: 12px; }
}

/* 顶栏与账号区：任何宽度下都禁止换行，避免名字/仓名逐字竖排 */
.topbar, .topbar-right { flex-wrap: nowrap; }
.topbar-right { min-width: 0; }
.topbar .breadcrumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip, .role-tag, .wh-chip { flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 900px) {
  /* 面包屑与多页签信息重复（页签上已有当前页名），窄屏省掉给账号区腾地方 */
  .breadcrumb { display: none; }
  /* 极窄时顶栏允许横向滚动，避免元素互相挤压重叠 */
  .topbar { overflow-x: auto; }
  /* 角色标签在极窄时不显示，从「账号」下拉里仍可看到 */
  .role-tag { display: none; }
}

/* =============================================================================
   仪表盘 · 可点击统计卡
   -----------------------------------------------------------------------------
   视觉目标（字节/阿里云控制台取向）：
   · 10 张卡在宽屏 5×2 排列，窄屏自动降列；
   · 左侧色块图标 + 右上箭头明确「可点」；hover 轻微上浮 + 主色描边；
   · 预警卡用语义色（低库存红 / 超上限橙）把注意力拉过去。
   ============================================================================= */
.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1500px) { .dash-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1180px) { .dash-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .dash-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .dash-stat-grid { grid-template-columns: repeat(1, minmax(0, 1fr)); } }

.stat-card.stat-click {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px 13px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  background: var(--c-bg-card);
  font-family: var(--font);
  color: var(--c-text-1);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.stat-card.stat-click:hover {
  transform: translateY(-2px);
  border-color: var(--c-primary);
  box-shadow: var(--shadow-card);
}
.stat-card.stat-click:active { transform: translateY(0); }
.stat-card.stat-click:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

.stat-card.stat-click .stat-icon {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--c-primary-light); color: var(--c-primary);
}
.stat-card.stat-click .stat-arrow {
  position: absolute; top: 17px; right: 13px;
  display: flex; color: var(--c-text-disabled);
  transition: color .16s, transform .16s;
}
.stat-card.stat-click:hover .stat-arrow { color: var(--c-primary); transform: translateX(2px); }
.stat-card.stat-click .stat-label {
  display: flex; align-items: center; gap: 6px;
  margin-top: 11px;
  font-size: var(--fs-2); line-height: 1.5; color: var(--c-text-2);
}
.stat-card.stat-click .stat-value {
  display: flex; align-items: baseline; gap: 3px;
  margin-top: 2px;
  font-size: 28px; line-height: 1.25; font-weight: 700;
  letter-spacing: -.5px;
}
.stat-card.stat-click .stat-value .stat-unit {
  font-size: var(--fs-1); font-weight: 400; color: var(--c-text-3);
}
.stat-card.stat-click .stat-foot {
  display: block; margin-top: 8px;
  font-size: var(--fs-1); line-height: 1.5; color: var(--c-text-3);
  white-space: normal;
}
.stat-card.stat-click .stat-bar {
  display: block; height: 4px; margin-top: 9px;
  border-radius: 2px; background: var(--c-bg-hover); overflow: hidden;
}
.stat-card.stat-click .stat-bar i { display: block; height: 100%; border-radius: 2px; background: var(--c-primary); }

/* 色调 */
.stat-card.tone-blue   .stat-icon { background: var(--c-primary-light); color: var(--c-primary); }
.stat-card.tone-teal   .stat-icon { background: rgba(20, 201, 201, .14); color: #0E9F9F; }
.stat-card.tone-violet .stat-icon { background: rgba(114, 46, 209, .12); color: #722ED1; }
.stat-card.tone-green  .stat-icon { background: var(--c-success-light); color: var(--c-success); }
.stat-card.tone-orange .stat-icon { background: var(--c-warning-light); color: var(--c-warning); }
.stat-card.tone-warning .stat-icon { background: var(--c-warning-light); color: var(--c-warning); }
.stat-card.tone-danger  .stat-icon { background: var(--c-danger-light); color: var(--c-danger); }
.stat-card.tone-danger  .stat-value { color: var(--c-danger); }
.stat-card.tone-warning .stat-value { color: var(--c-warning); }
.stat-card.tone-teal .stat-bar i { background: #14C9C9; }
.stat-card.tone-violet .stat-bar i { background: #722ED1; }
.stat-card.tone-green .stat-bar i { background: var(--c-success); }
.stat-card.tone-orange .stat-bar i { background: var(--c-warning); }

/* 暗黑模式下浅色底会发灰，用半透明色块保持层次 */
html[data-theme="dark"] .stat-card.tone-blue .stat-icon { background: rgba(22, 100, 255, .18); }
html[data-theme="dark"] .stat-card.tone-teal .stat-icon { background: rgba(20, 201, 201, .16); }
html[data-theme="dark"] .stat-card.tone-violet .stat-icon { background: rgba(114, 46, 209, .2); }
html[data-theme="dark"] .stat-card.tone-green .stat-icon { background: rgba(0, 180, 42, .16); }
html[data-theme="dark"] .stat-card.tone-orange .stat-icon,
html[data-theme="dark"] .stat-card.tone-warning .stat-icon { background: rgba(255, 125, 0, .16); }
html[data-theme="dark"] .stat-card.tone-danger .stat-icon { background: rgba(245, 63, 63, .16); }

/* =============================================================================
   仪表盘 · 各仓库存预警卡
   ============================================================================= */
.wh-warn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}
.wh-warn {
  display: block; width: 100%; text-align: left;
  padding: 14px;
  border: 1px solid var(--c-border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  background: var(--c-bg-card);
  font-family: var(--font); color: var(--c-text-1);
  cursor: pointer;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.wh-warn:hover { border-color: var(--c-primary); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.wh-warn.has-warn { border-left-color: var(--c-danger); }
.wh-warn.is-clear { border-left-color: var(--c-success); }
.wh-warn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wh-warn-name { font-size: var(--fs-3); font-weight: 700; }
.wh-warn-metrics { display: flex; align-items: flex-end; gap: 26px; margin-top: 10px; }
.wh-metric span { display: block; font-size: var(--fs-1); color: var(--c-text-3); }
.wh-metric b { font-size: 24px; line-height: 1.2; font-weight: 700; }
.wh-metric em { font-style: normal; font-size: var(--fs-1); color: var(--c-text-3); margin-left: 2px; }
.wh-metric.low b { color: var(--c-danger); }
.wh-metric.high b { color: var(--c-warning); }
.wh-warn-bar { display: flex; height: 4px; margin-top: 10px; border-radius: 2px; overflow: hidden; background: var(--c-bg-hover); }
.wh-warn-bar i { display: block; height: 100%; }
.wh-warn-bar i.low { background: var(--c-danger); }
.wh-warn-bar i.high { background: var(--c-warning); }
.wh-warn-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 10px;
  font-size: var(--fs-1); color: var(--c-text-3);
}
.wh-warn-link { display: inline-flex; align-items: center; gap: 2px; color: var(--c-primary); }

/* =============================================================================
   库存预警明细弹窗
   ============================================================================= */
.warn-modal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.warn-modal-scope { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-1); color: var(--c-text-3); }
.warn-modal-search { flex: 1; min-width: 180px; }
.warn-modal-search .input { width: 100%; }
.warn-modal-meta {
  padding: 8px 10px; margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--c-bg-sunken);
  font-size: var(--fs-1); line-height: 1.6; color: var(--c-text-2);
}
.warn-table td { height: 54px; }
.ratio-bar {
  display: inline-block; width: 110px; height: 6px;
  border-radius: 3px; overflow: hidden; vertical-align: middle;
  background: var(--c-bg-hover); margin-right: 6px;
}
.ratio-bar i { display: block; height: 100%; }
.ratio-bar i.low { background: var(--c-danger); }
.ratio-bar i.high { background: var(--c-warning); }
.diff-warn { color: var(--c-warning); font-weight: 700; }

/* 分段控制器（弹窗内低库存/超上限切换） */
.seg {
  display: inline-flex; align-items: center;
  padding: 2px; gap: 2px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-bg-sunken);
}
.seg-btn {
  height: 26px; padding: 0 12px;
  border: 0; border-radius: 6px;
  background: transparent;
  font-family: var(--font); font-size: var(--fs-2); color: var(--c-text-2);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg-btn:hover { color: var(--c-text-1); }
.seg-btn.is-active {
  background: var(--c-bg-card); color: var(--c-primary);
  font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

/* =============================================================================
   系统配置 · 业务参数按仓配置
   ============================================================================= */
.config-scope-tip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-primary);
  border-radius: var(--radius-md);
  background: var(--c-primary-light);
  font-size: var(--fs-2);
  line-height: 1.75;
  color: var(--c-text-2);
}
.config-scope-tip.is-wh {
  border-left-color: var(--c-warning);
  background: var(--c-warning-light);
}
.config-scope-tip .icon { flex: 0 0 auto; margin-top: 4px; color: var(--c-primary); }
.config-scope-tip.is-wh .icon { color: var(--c-warning); }

.biz-input-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* =============================================================================
   导出中心
   ============================================================================= */
.export-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
  align-items: start;
}
@media (max-width: 1180px) { .export-layout { grid-template-columns: minmax(0, 1fr); } }

.export-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.export-module {
  display: block; width: 100%; text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  background: var(--c-bg-card);
  font-family: var(--font); color: var(--c-text-1);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.export-module:hover { border-color: var(--c-primary); background: var(--c-primary-light); }
.export-module.is-active {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
  box-shadow: inset 0 0 0 1px var(--c-primary);
}
.export-module .em-name { font-size: var(--fs-3); font-weight: 700; }
.export-module .em-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 5px;
  font-size: var(--fs-1); line-height: 1.55; color: var(--c-text-3);
}
.export-module .em-cat { margin-top: 8px; }

.export-config .form-item { margin-bottom: 16px; }
.export-config .date-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.export-config .date-row .input { width: 150px; }
.export-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.export-presets .preset {
  height: 26px; padding: 0 10px;
  border: 1px solid var(--c-border); border-radius: 13px;
  background: var(--c-bg-card);
  font-family: var(--font); font-size: var(--fs-1); color: var(--c-text-2);
  cursor: pointer;
  transition: all .15s;
}
.export-presets .preset:hover { border-color: var(--c-primary); color: var(--c-primary); }
.export-presets .preset.is-active { border-color: var(--c-primary); background: var(--c-primary-light); color: var(--c-primary); }
.export-summary {
  padding: 12px 14px; margin: 4px 0 14px;
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--radius-md);
  background: var(--c-bg-sunken);
  font-size: var(--fs-2); line-height: 1.7; color: var(--c-text-2);
}
.export-summary b { color: var(--c-text-1); }
.export-summary .big { font-size: var(--fs-5); font-weight: 700; color: var(--c-primary); }
.export-columns { display: flex; flex-wrap: wrap; gap: 6px; }
.export-columns .tag { font-weight: 400; }
.export-actions { display: flex; gap: 8px; align-items: center; }
.export-tip { font-size: var(--fs-1); line-height: 1.7; color: var(--c-text-3); }
.export-tip li { margin-left: 16px; list-style: disc; }

/* ---------------- 各板块「清理设置」弹窗 ---------------- */
.cleanup-panel { display: flex; flex-direction: column; gap: 12px; }
.cleanup-row,
.cleanup-pending {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border: 1px solid var(--c-border);
  border-radius: var(--radius-md); background: var(--c-bg-sunken);
}
.cleanup-info { min-width: 0; }
.cleanup-title { font-size: var(--fs-2); font-weight: 700; color: var(--c-text-1); }
.cleanup-desc { margin-top: 4px; font-size: var(--fs-1); line-height: 1.6; color: var(--c-text-3); }
.cleanup-count { display: flex; align-items: baseline; gap: 4px; color: var(--c-text-3); }
.cleanup-count b { font-size: var(--fs-5); font-weight: 700; color: var(--c-danger); font-variant-numeric: tabular-nums; }
.cleanup-count span { font-size: var(--fs-1); }
.cleanup-switch { position: relative; display: inline-flex; cursor: pointer; }
.cleanup-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.cleanup-switch-track {
  width: 42px; height: 24px; border-radius: 12px; background: var(--c-text-disabled);
  transition: background .18s ease; position: relative;
}
.cleanup-switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.cleanup-switch input:checked + .cleanup-switch-track { background: var(--c-primary); }
.cleanup-switch input:checked + .cleanup-switch-track::after { transform: translateX(18px); }
.cleanup-seg { display: inline-flex; border: 1px solid var(--c-border); border-radius: var(--radius-md); overflow: hidden; flex: none; }
.cleanup-seg-item { position: relative; cursor: pointer; }
.cleanup-seg-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.cleanup-seg-item span {
  display: inline-block; padding: 7px 16px; font-size: var(--fs-2); color: var(--c-text-2);
  background: var(--c-bg); border-left: 1px solid var(--c-border); transition: all .15s ease;
}
.cleanup-seg-item:first-child span { border-left: 0; }
.cleanup-seg-item input:checked + span { background: var(--c-primary); color: #fff; }
.cleanup-tip {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: var(--fs-1); line-height: 1.7; color: var(--c-text-3);
}
.cleanup-tip .icon { width: 14px; height: 14px; flex: none; margin-top: 3px; }
.cleanup-row-top { align-items: flex-start; }
.cleanup-days { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; max-width: 340px; }
.cleanup-custom { display: flex; align-items: center; gap: 6px; }
.cleanup-custom .input { width: 96px; }
.cleanup-days .field-hint { margin-top: 0; text-align: right; }
.cleanup-seg-item input:disabled + span { opacity: .45; cursor: not-allowed; }

