/* ===== 全局 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  font-size: 14px; color: #1f2937; background: #f1f5f9;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: #6b7280; font-size: 12px; }
.err { color: #dc2626; font-size: 13px; margin: 8px 0; }
.err-inline { color: #dc2626; font-size: 13px; margin-left: 10px; }
.req { color: #dc2626; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%); padding: 20px;
}
.login-card {
  width: 320px; max-width: calc(100vw - 40px);
  background: #fff; border-radius: 12px; padding: 28px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3); text-align: center;
  box-sizing: border-box;
}
.login-card h2 { margin-bottom: 8px; font-size: 20px; }
.login-tip { color: #6b7280; font-size: 12px; margin-bottom: 22px; line-height: 1.6; }
.login-field { margin-bottom: 14px; position: relative; }
.login-field input { width: 100%; box-sizing: border-box; }
.login-field.pwd-field input { padding-right: 36px; }
.pwd-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 0; margin: 0;
  cursor: pointer; font-size: 16px; line-height: 1;
  color: #9ca3af; border-radius: 4px; width: auto;
}
.pwd-toggle:hover { background: #f3f4f6; color: #1f2937; }
.login-card .login-submit { width: 100%; margin-top: 6px; }

/* ===== 输入控件 ===== */
input, select {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 13px; outline: none; background: #fff; color: #1f2937;
}
input:focus, select:focus {
  border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}

/* ===== 按钮 ===== */
button {
  padding: 8px 16px; border: 1px solid transparent; border-radius: 6px;
  font-size: 13px; cursor: pointer; background: #e5e7eb; color: #1f2937;
}
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: #2563eb; color: #fff; }
button.primary:hover:not(:disabled) { background: #1d4ed8; }
button.danger { background: #fff; color: #dc2626; border-color: #fca5a5; }
button.danger:hover:not(:disabled) { background: #fef2f2; }
.link-btn { background: none; border: none; color: #2563eb; padding: 0 4px; }
.link-btn:hover { text-decoration: underline; }

/* ===== 布局 ===== */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 232px; background: #1e293b; color: #cbd5e1;
  display: flex; flex-direction: column; flex-shrink: 0;
  transition: width .25s ease; /* 折叠/展开过渡 250ms */
}
/* 顶部品牌行 + 折叠切换按钮 */
.brand-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-text {
  font-size: 16px; font-weight: 700; color: #fff; white-space: nowrap;
  max-width: 170px; overflow: hidden;
  transition: opacity .2s ease, max-width .25s ease;
}
.sidebar-toggle {
  flex-shrink: 0; width: 26px; height: 26px; border: none; border-radius: 6px;
  background: rgba(255, 255, 255, .1); color: #cbd5e1;
  font-size: 14px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .2s, color .2s, transform .25s ease;
}
.sidebar-toggle:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.sidebar-toggle:active { transform: scale(.9); }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.nav a {
  display: flex; align-items: center; gap: 8px; padding: 9px 20px;
  color: #cbd5e1; font-size: 13px; border-left: 3px solid transparent;
  white-space: nowrap; overflow: hidden;
}
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.nav a.active { background: rgba(37, 99, 235, .25); border-left-color: #3b82f6; color: #fff; }
.nav .no {
  width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, .12);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}
.nav-icon { flex-shrink: 0; }
.nav-text {
  flex-shrink: 0; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .2s ease, max-width .25s ease;
}
.nav-group { padding: 14px 20px 4px; font-size: 11px; color: #64748b; letter-spacing: 1px; }

/* 折叠态：仅图标，文字淡出，分组标签收缩为分隔线 */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand-row { padding: 14px 10px; justify-content: center; }
.sidebar.collapsed .brand-text { opacity: 0; max-width: 0; }
.sidebar.collapsed .nav a { justify-content: center; gap: 0; padding: 9px 0; }
.sidebar.collapsed .nav-text { opacity: 0; max-width: 0; }
.sidebar.collapsed .nav-group {
  font-size: 0; padding: 0; height: 1px; margin: 8px 12px; letter-spacing: 0;
  background: rgba(255, 255, 255, .12); overflow: hidden;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 52px; background: #fff; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; flex-shrink: 0;
}
.sys { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4b5563; }
.run-chip {
  background: #dbeafe; color: #1d4ed8; font-size: 12px;
  padding: 2px 10px; border-radius: 999px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
.user { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ===== 页面通用 ===== */
.task-page h2 { font-size: 18px; margin-bottom: 6px; }
.desc { color: #6b7280; font-size: 13px; margin-bottom: 16px; line-height: 1.6; }
.form-card {
  background: #fff; border-radius: 10px; padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08); max-width: 660px; margin-bottom: 16px;
}
.form-row { margin-bottom: 14px; }
.form-row > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.form-row input, .form-row select { width: 100%; max-width: 420px; }
.file-name { display: block; color: #16a34a; font-size: 12px; margin-top: 4px; }
.btn-row { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* 任务结果 */
.task-result {
  background: #fff; border-radius: 10px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.task-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.outputs { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e5e7eb; }
.outputs h4 { font-size: 13px; margin-bottom: 6px; }
.outputs a { display: inline-block; margin-right: 16px; font-size: 13px; }

/* 状态徽标 */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.badge.queued { background: #f3f4f6; color: #4b5563; }
.badge.running { background: #dbeafe; color: #1d4ed8; }
.badge.success { background: #dcfce7; color: #15803d; }
.badge.failed { background: #fee2e2; color: #b91c1c; }
.badge.stopped { background: #ffedd5; color: #c2410c; }
.badge.running { animation: badge-pulse 2s infinite; }
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .3); }
  50% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0); }
}

/* 日志面板（可折叠 + 进度条） */
.log-panel {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  overflow: hidden; margin-top: 10px;
}
.log-panel-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; background: #f8fafc; border-bottom: 1px solid #e5e7eb;
  user-select: none; transition: background .15s;
}
.log-panel-header:hover { background: #f1f5f9; }
.toggle-icon {
  font-size: 10px; color: #6b7280; transition: transform .25s;
  display: inline-block; width: 14px; text-align: center; flex-shrink: 0;
}
.toggle-icon.open { transform: rotate(90deg); }
.log-title { font-size: 13px; font-weight: 600; color: #374151; flex-shrink: 0; }
.log-count { font-size: 11px; margin-left: auto; flex-shrink: 0; }

/* 进度条 */
.progress-track {
  flex: 1; height: 20px; background: #e5e7eb; border-radius: 999px;
  position: relative; overflow: hidden; max-width: 380px; min-width: 140px;
}
.progress-fill {
  height: 100%; border-radius: 999px; transition: width .5s ease;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}
.progress-fill.done { background: linear-gradient(90deg, #4ade80, #16a34a); }
.progress-fill.indeterminate {
  width: 35% !important;
  background: linear-gradient(90deg, #93c5fd, #3b82f6);
  animation: indeterminate 1.4s infinite ease-in-out;
}
.progress-track.no-fill .progress-label { color: #6b7280; text-shadow: none; }
@keyframes indeterminate {
  0% { transform: translateX(-120%); }
  50% { transform: translateX(260%); }
  100% { transform: translateX(-120%); }
}
.progress-label {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 500; color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4); white-space: nowrap;
}

/* 折叠动画 */
.log-viewer-wrap {
  max-height: 460px; overflow: hidden;
  transition: max-height .35s ease;
}
.log-viewer-wrap.collapsed { max-height: 0; }

/* 日志终端 */
.log-viewer {
  background: #0f172a; color: #e2e8f0; border-radius: 0 0 8px 8px;
  font-family: Consolas, Monaco, "Courier New", monospace; font-size: 12px;
  line-height: 1.7; padding: 12px 14px; height: 340px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.log-line { min-height: 1em; }
.log-end { text-align: center; color: #64748b; font-style: italic; margin-top: 6px; }
.log-empty { color: #64748b; font-style: italic; text-align: center; padding: 20px; }
.log-viewer::-webkit-scrollbar { width: 8px; }
.log-viewer::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* 表格 */
.tbl {
  width: 100%; background: #fff; border-collapse: collapse;
  border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.tbl th, .tbl td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid #f1f5f9;
  font-size: 13px; vertical-align: top;
}
.tbl th { background: #f8fafc; font-weight: 600; color: #374151; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .log-row td { background: #f8fafc; }
.crumbs { margin-bottom: 12px; font-size: 13px; }
.danger-link { color: #dc2626; margin-left: 10px; }

/* 工作台卡片 */
.home-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.home-card {
  background: #fff; border-radius: 10px; padding: 16px; display: flex; gap: 14px;
  cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); transition: all .15s;
}
.home-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .12); }
.home-card .no {
  width: 34px; height: 34px; border-radius: 8px; background: #dbeafe; color: #1d4ed8;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.home-card h3 { font-size: 14px; margin-bottom: 4px; }
.home-card .muted { line-height: 1.5; }

/* 看板占位 */
.chart-placeholder {
  background: #fff; border: 2px dashed #cbd5e1; border-radius: 10px;
  min-height: 420px; display: flex; align-items: center; justify-content: center;
}
.placeholder-inner { text-align: center; color: #6b7280; }
.placeholder-inner p:first-child { font-size: 15px; margin-bottom: 6px; }

/* 响应式：窄屏侧边栏折叠为顶部横向导航 */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; transition: none; }
  /* 折叠态在窄屏保持一致交互：仅图标横向排列 */
  .sidebar.collapsed { width: 100%; }
  .brand-row {
    border-bottom: none; border-right: 1px solid rgba(255, 255, 255, .08);
    flex-shrink: 0; padding: 8px 10px 8px 14px;
  }
  .nav { display: flex; align-items: center; padding: 0; }
  .nav a {
    white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; padding: 14px 12px;
  }
  .nav a.active { border-bottom-color: #3b82f6; }
  .nav .no, .nav-group { display: none; }
  .sidebar.collapsed .nav a { padding: 14px 10px; }
  .sidebar.collapsed .brand-text, .sidebar.collapsed .nav-text { opacity: 0; max-width: 0; }
  .content { padding: 14px; }
}

/* ===== 数据看板（DashboardPage） ===== */
.dashboard-page h2 { font-size: 18px; margin-bottom: 6px; }

/* 顶部条：状态卡片行 + 刷新按钮 */
.dash-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
}
.dash-cards {
  display: flex; gap: 12px; flex: 1 1 auto; flex-wrap: wrap;
}

/* 单个状态卡片 */
.dash-card {
  flex: 1 1 160px; min-width: 150px;
  background: #fff; border: 1px solid #e6eaf0; border-radius: 10px;
  padding: 14px 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.dash-card .num {
  font-size: 26px; font-weight: 800; color: #1f2937; line-height: 1.2; letter-spacing: .5px;
}
.dash-card .num.sm { font-size: 15px; font-weight: 600; }
.dash-card .label { font-size: 12px; color: #6b7280; margin-top: 4px; font-weight: 600; }
.dash-card .sub { font-size: 11px; color: #9ca3af; margin-top: 3px; line-height: 1.5; }

/* 卡片配色：警示/信息 */
.dash-card.warn { background: linear-gradient(135deg, #fff5f5 0%, #fef2f2 100%); border-color: #fecaca; }
.dash-card.warn .num { color: #dc2626; }
.dash-card.amber { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: #fde68a; }
.dash-card.amber .num { color: #b45309; }
.dash-card.info { background: linear-gradient(135deg, #eff6ff 0%, #f0f7ff 100%); border-color: #bfdbfe; }
.dash-card.info .num { color: #2563eb; }
.dash-rate-cards .dash-card { flex: 1 1 200px; }

/* 刷新按钮（含 loading 旋转动画） */
.dash-refresh {
  padding: 10px 18px; font-size: 13px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.dash-spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  border-radius: 50%; animation: dash-spin .7s linear infinite;
}
@keyframes dash-spin { to { transform: rotate(360deg); } }

/* 操作按钮组（立即获取数据 / 上传 CSV） */
.dash-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-file-hidden { display: none; }
.dash-refresh.ghost {
  background: #fff; color: #2563eb; border: 1px solid #bfdbfe;
}
.dash-refresh.ghost:hover:not(:disabled) { background: #eff6ff; border-color: #93c5fd; }
.dash-refresh.ghost:disabled { opacity: .6; cursor: not-allowed; }
.dash-spin.dark {
  border: 2px solid rgba(37, 99, 235, .25); border-top-color: #2563eb;
}

/* 覆盖确认弹窗（当天已有数据时上传） */
.dash-modal-mask {
  position: fixed; inset: 0; z-index: 2000; padding: 18px;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
  animation: dash-fade .16s ease-out;
}
.dash-modal {
  width: 100%; max-width: 420px; background: #fff; border-radius: 14px;
  padding: 22px 22px 18px; box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
  animation: dash-pop .18s ease-out;
}
.dash-modal-icon {
  width: 38px; height: 38px; border-radius: 50%; margin-bottom: 10px;
  background: #fef3c7; color: #b45309; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.dash-modal h4 { font-size: 16px; color: #111827; margin: 0 0 8px; }
.dash-modal-text { font-size: 13px; color: #4b5563; line-height: 1.7; margin: 0 0 10px; }
.dash-modal-text b { color: #b45309; }
.dash-modal-file {
  font-size: 12px; color: #6b7280; background: #f8fafc; margin: 0 0 16px;
  border: 1px dashed #dbe2ea; border-radius: 8px; padding: 7px 10px;
  word-break: break-all;
}
.dash-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.dash-modal-danger {
  background: #dc2626; color: #fff; border: 1px solid #dc2626; cursor: pointer;
  padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.dash-modal-danger:hover { background: #b91c1c; border-color: #b91c1c; }
@keyframes dash-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dash-pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* 抓取提示 / 空数据提示 */
.dash-fetch-msg { color: #6b7280; font-size: 13px; margin: -4px 0 14px; }
.dash-empty {
  color: #9ca3af; font-size: 14px; padding: 20px; text-align: center;
  background: #fff; border-radius: 10px; margin-bottom: 14px;
}

/* 每日自动拉取配置面板 */
.auto-fetch-panel {
  background: #fff; border: 1px solid #e6eaf0; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.auto-fetch-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.auto-fetch-toggle {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 14px; color: #1f3864; font-weight: 500;
}
.auto-fetch-toggle input { width: 16px; height: 16px; cursor: pointer; }
.auto-fetch-status { font-size: 12px; }
.auto-fetch-config {
  display: flex; align-items: center; gap: 16px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid #f0f0f0; flex-wrap: wrap;
}
.auto-fetch-field {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: #4b5563;
}
.auto-fetch-input {
  padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 13px; background: #fff; cursor: pointer;
}
.auto-fetch-trigger {
  padding: 5px 14px; border: 1px solid #3b82f6; border-radius: 6px;
  background: #eff6ff; color: #1d4ed8; font-size: 13px; cursor: pointer;
  transition: all .15s;
}
.auto-fetch-trigger:hover:not(:disabled) { background: #dbeafe; }
.auto-fetch-trigger:disabled { opacity: .5; cursor: not-allowed; }

/* 任务中心来源标签 */
.src-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 11px; background: #f3f4f6; color: #6b7280;
}
.src-badge.auto { background: #fef3c7; color: #92400e; }
.src-badge.retry { background: #ede9fe; color: #6d28d9; }
.retry-link { color: #d97706; margin-left: 8px; }
.retry-link:hover { text-decoration: underline; }
.task-err {
  color: #b91c1c; font-size: 13px; padding: 6px 10px; margin-bottom: 8px;
  background: #fef2f2; border-radius: 6px; border-left: 3px solid #ef4444;
}
.muted.small { font-size: 11px; }

/* 分区块容器 */
.dash-section {
  background: #fff; border: 1px solid #e6eaf0; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.dash-sec-title {
  font-size: 15px; color: #1f3864; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.dash-tag { font-size: 12px; color: #6b7280; font-weight: 400; }

/* 图表区：分布图（结构概览，窄）+ 趋势图（时间序列，宽），2:3 空间分配 */
.dash-charts {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr);
  gap: 16px;
  align-items: stretch;
}
.dash-chart {
  min-width: 0;
  display: flex; flex-direction: column;
  background: #f8fafc;
  border: 1px solid #edf1f6;
  border-radius: 10px;
  padding: 14px 16px 10px;
}
.dash-chart-title {
  font-size: 13px; font-weight: 600; color: #1f3864;
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.dash-chart-title::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: #2563eb; flex-shrink: 0;
}
.dash-chart-body { width: 100%; height: 300px; flex: 1; min-height: 300px; }

/* 对比日选择器 */
.dash-pickrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.dash-pick {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: #4b5563; font-weight: 600;
}
.dash-pick select { min-width: 180px; }

/* 网格库库存情况表格 */
.dash-tblwrap { overflow-x: auto; border-radius: 8px; border: 1px solid #e6eaf0; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.dash-table th, .dash-table td {
  border: 1px solid #e6eaf0; padding: 7px 10px; text-align: center; white-space: nowrap;
}
.dash-table thead th { background: #f1f5f9; color: #1f3864; font-weight: 700; }
.dash-table td.red, .dash-table th.red { color: #dc2626; font-weight: 700; }
.dash-table tr.quku td { background: #fbfcfe; color: #6b7a90; }
.dash-table tr.total td { background: #fffbeb; font-weight: 700; }
.dash-note { margin-top: 8px; line-height: 1.6; }

/* 加载中动画 */
.dash-loading {
  display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px 20px;
}
.dash-spinner {
  width: 36px; height: 36px; border: 3px solid #e5e7eb; border-top-color: #2563eb;
  border-radius: 50%; animation: dash-spin .8s linear infinite;
}

/* 响应式：平板及以下图表纵向堆叠，移动端降低图高保证可读性 */
@media (max-width: 900px) {
  .dash-charts { grid-template-columns: 1fr; gap: 12px; }
  .dash-chart-body { height: 280px; min-height: 280px; }
}
@media (max-width: 560px) {
  .dash-chart { padding: 12px 10px 8px; }
  .dash-chart-body { height: 250px; min-height: 250px; }
}

/* ===== 物资清单页：整页 flex 纵向布局，仅表格区域内部滚动（同 .scanh-page 模式）===== */
.inv-page { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.inv-page > h2,
.inv-page > .desc,
.inv-page > .inv-searchbar,
.inv-page > .inv-filterbar,
.inv-page > .inv-tags,
.inv-page > .inv-batchbar,
.inv-page > .inv-import-msg,
.inv-page > .err,
.inv-page > .dash-loading,
.inv-page > .dash-empty,
.inv-page > .inv-pager { flex-shrink: 0; }
.inv-page h2 { font-size: 18px; margin-bottom: 6px; }
.inv-page .desc { margin-bottom: 14px; }

/* ===== 筛选区：搜索栏 ===== */
.inv-searchbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: #fff; border: 1px solid #e6eaf0; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.inv-search-input {
  position: relative; flex: 1 1 260px; min-width: 200px;
  display: flex; align-items: center;
}
.inv-search-icon {
  position: absolute; left: 12px; color: #94a3b8; font-size: 16px; pointer-events: none;
}
.inv-search-input input {
  width: 100%; padding: 9px 36px 9px 34px; border: 1px solid #d6dbe4; border-radius: 8px;
  font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.inv-search-input input:focus {
  border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.inv-search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: none; background: #e5e7eb; color: #6b7280; width: 18px; height: 18px;
  border-radius: 50%; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.inv-search-clear:hover { background: #d1d5db; }
.inv-search-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-ghost, .btn-primary {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: all .15s; white-space: nowrap;
}
.btn-ghost { background: #fff; border-color: #d6dbe4; color: #4b5563; }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; border-color: #94a3b8; }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* ===== 筛选维度下拉按钮区 ===== */
.inv-filterbar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.inv-dd { position: relative; }
.inv-dd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; background: #fff; border: 1px solid #d6dbe4; border-radius: 8px;
  font-size: 13px; color: #374151; cursor: pointer; transition: all .15s;
}
.inv-dd-btn:hover { border-color: #93c5fd; background: #f8fafc; }
.inv-dd-btn.active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; }
.inv-dd-btn.open { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.inv-dd-label { font-weight: 500; }
.inv-dd-count {
  background: #2563eb; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.inv-dd-arrow { color: #94a3b8; font-size: 10px; transition: transform .15s; }
.inv-dd-btn.open .inv-dd-arrow { transform: rotate(180deg); }

/* 下拉面板 */
.inv-dd-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 100;
  min-width: 220px; max-width: 320px; max-height: 320px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12); display: flex; flex-direction: column;
  overflow: hidden;
}
.inv-dd-search { padding: 8px; border-bottom: 1px solid #f1f5f9; }
.inv-dd-search input {
  width: 100%; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12.5px; outline: none;
}
.inv-dd-search input:focus { border-color: #3b82f6; }
.inv-dd-list {
  flex: 1; overflow-y: auto; padding: 4px;
}
.inv-dd-opt {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; transition: background .1s;
}
.inv-dd-opt:hover { background: #f1f5f9; }
.inv-dd-opt input[type=checkbox] { accent-color: #2563eb; width: 14px; height: 14px; }
.inv-dd-opt-label { flex: 1; font-size: 13px; color: #334155; }
.inv-dd-opt-count { font-size: 11px; color: #94a3b8; background: #f1f5f9; padding: 1px 6px; border-radius: 8px; }
.inv-dd-empty { text-align: center; color: #94a3b8; font-size: 12px; padding: 16px 0; }
.inv-dd-foot {
  display: flex; gap: 8px; padding: 8px; border-top: 1px solid #f1f5f9;
}
.inv-dd-foot button {
  flex: 1; padding: 5px 0; border: 1px solid #e2e8f0; background: #fff;
  border-radius: 6px; font-size: 12px; color: #475569; cursor: pointer; transition: all .1s;
}
.inv-dd-foot button:hover { background: #f1f5f9; border-color: #cbd5e1; }

/* 入库时间日期范围面板 */
.inv-dd-date { display: flex; flex-direction: row; padding: 12px; align-items: flex-end; gap: 8px; min-width: 280px; }
.inv-date-field { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.inv-date-field span { font-size: 11px; color: #64748b; font-weight: 600; }
.inv-date-field input {
  padding: 6px 8px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 12.5px; outline: none;
}
.inv-date-field input:focus { border-color: #3b82f6; }
.inv-date-sep { color: #94a3b8; font-weight: 700; }
.inv-date-clear {
  align-self: flex-end; padding: 5px 12px; border: 1px solid #e2e8f0; background: #fff;
  border-radius: 6px; font-size: 12px; color: #64748b; cursor: pointer;
}
.inv-date-clear:hover { background: #f1f5f9; }

/* 已选条件标签 */
.inv-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 12px; background: #f8fafc; border: 1px dashed #e2e8f0; border-radius: 8px;
  margin-bottom: 12px;
}
.inv-tags-label { font-size: 12px; color: #64748b; font-weight: 600; }
.inv-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 14px;
  font-size: 12px; color: #1e40af;
}
.inv-tag button {
  border: none; background: transparent; color: #60a5fa; cursor: pointer;
  font-size: 12px; padding: 0; line-height: 1;
}
.inv-tag button:hover { color: #1d4ed8; }

/* 数据表格加载遮罩 */
/* 唯一滚动容器：吃掉剩余高度，横向+纵向滚动条均在此处（内容超出才显示） */
.inv-tblwrap { flex: 1 1 auto; min-height: 120px; min-width: 0; overflow: auto; position: relative;
  border-radius: 8px; border: 1px solid #e6eaf0; background: #fff; }
.inv-loading-overlay {
  position: absolute; inset: 0; background: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center; z-index: 5;
}
.inv-table { width: 100%; min-width: max-content; border-collapse: collapse; font-size: 12.8px; }
.inv-table th, .inv-table td {
  border: 1px solid #e6eaf0; padding: 7px 8px; text-align: center; white-space: nowrap;
}
.inv-table thead th { background: #f1f5f9; color: #1f3864; font-weight: 700;
  position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 #d8dee8; }
/* 列宽按内容自然撑开（table-layout: auto），内容超宽时由 .inv-tblwrap 出横向滚动条，不压缩列宽 */
.inv-table th:nth-child(1) { width: 36px; }           /* 复选框 */
/* 长文本列：max-width 上限 + 省略号（title 悬停显示完整值）；table-layout:auto 下需作用于内容 */
.inv-table td.cell-clip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
/* 日期列：禁止换行（内容本身为 YYYY-MM-DD，无需截断） */
.inv-table td.cell-date { white-space: nowrap; }
/* 滚动条样式（与系统浅色风格一致，Webkit 内核） */
.inv-tblwrap::-webkit-scrollbar { width: 10px; height: 10px; }
.inv-tblwrap::-webkit-scrollbar-track { background: #f1f5f9; }
.inv-tblwrap::-webkit-scrollbar-thumb { background: #c7d2e0; border-radius: 6px; }
.inv-tblwrap::-webkit-scrollbar-thumb:hover { background: #a8b8cc; }
.inv-table tbody tr { cursor: pointer; }
.inv-table tbody tr:hover td { background: #f8fafc; }
/* 批量选择复选框列 */
.inv-table th.cb, .inv-table td.cb { width: 36px; min-width: 36px; padding: 7px 4px; }
.inv-table th.cb input, .inv-table td.cb input { width: 15px; height: 15px; margin: 0; cursor: pointer; }
/* 选中行高亮（与全站其他列表页选中风格一致） */
.inv-table tbody tr.row-selected td { background: #eaf3ff; }
.inv-table tbody tr.row-selected:hover td { background: #dbeafe; }
.inv-batchbar { margin: 8px 0; }
.inv-toggle { color: #2563eb; font-size: 12px; white-space: nowrap; }

/* 列设置下拉面板 */
.inv-cols { position: relative; }
.inv-cols-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: #fff; border: 1px solid #dbe3ee; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12); padding: 10px 14px;
  min-width: 220px; max-height: 60vh; overflow-y: auto; text-align: left;
}
.inv-cols-group + .inv-cols-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef2f7; }
.inv-cols-group-title { font-size: 12px; font-weight: 700; color: #1f3864; margin-bottom: 4px; }
.inv-cols-panel label.cb {
  display: flex; align-items: center; gap: 6px; padding: 3px 0;
  font-size: 12.8px; color: #1f2937; cursor: pointer; white-space: nowrap;
}
.inv-cols-foot { display: flex; gap: 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #eef2f7; }
.inv-cols-foot button { background: none; border: none; color: #2563eb; font-size: 12.5px; cursor: pointer; padding: 0; }
.inv-cols-foot button:hover { text-decoration: underline; }
.inv-cols-backdrop { position: fixed; inset: 0; z-index: 25; }

/* 导入数据类型选择面板 */
.inv-import-wrap { position: relative; display: inline-block; }
.inv-import-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: #fff; border: 1px solid #dbe3ee; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12); padding: 12px 14px;
  min-width: 240px; text-align: left;
}
.inv-import-panel-title { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: #1f2937; }
.inv-import-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 8px 10px; margin-top: 6px; cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.inv-import-opt:hover:not(:disabled) { border-color: #2563eb; background: #eff6ff; }
.inv-import-opt:disabled { opacity: .55; cursor: not-allowed; }
.inv-import-opt-name { font-size: 13px; font-weight: 600; color: #1f2937; }
.inv-import-opt-desc { font-size: 11.5px; color: #64748b; }
.inv-import-panel-tip { margin: 8px 0 0; font-size: 11px; color: #94a3b8; }

/* 导入结果提示 */
.inv-import-msg { margin: 6px 0 0; font-size: 12.8px; color: #2e7d32; }

/* 是否已送修状态高亮：已送修=橙，已返回=绿 */
.inv-table td.inv-repair-sent { color: #b45309; font-weight: 700; }
.inv-table td.inv-repair-back { color: #15803d; font-weight: 700; }

/* 展开行：显示该 SN 的全部字段 */
.inv-table tr.expanded td { background: #f8fafc; text-align: left; white-space: normal; padding: 0; }
.inv-detail {
  display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 8px 12px;
  /* 宽度由 JS 内联设为表格容器可视宽；sticky 左缘使横向滚动时详情保持可见不被裁切 */
  position: sticky; left: 0;
  box-sizing: border-box;
}
.inv-detail-item { display: flex; align-items: baseline; gap: 6px; min-width: 160px; }
.inv-detail-k { color: #6b7280; font-size: 12px; font-weight: 600; white-space: nowrap; }
.inv-detail-v { color: #1f2937; font-size: 12.8px; word-break: break-all; }

/* 分页控件 */
.inv-pager {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; font-size: 13px; color: #4b5563;
}
.inv-page-info { white-space: nowrap; }
.inv-page-size { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.inv-page-size select { min-width: 80px; }

/* 响应式适配 */
@media (max-width: 768px) {
  .inv-searchbar { flex-direction: column; align-items: stretch; }
  /* 纵向排列后 260px 是宽度基准，不能继续作为纵向 flex-basis（否则输入框被拉高） */
  .inv-search-input { flex: 0 0 auto; width: 100%; min-width: 0; }
  .inv-search-actions { justify-content: flex-end; }
  .inv-filterbar { gap: 6px; }
  .inv-dd-btn { padding: 6px 10px; font-size: 12px; }
  .inv-dd-panel { min-width: 200px; max-width: calc(100vw - 32px); }
  .inv-dd-date { flex-wrap: wrap; }
  .inv-table { font-size: 11.5px; }
  .inv-table th, .inv-table td { padding: 5px 5px; }
  .inv-table th.cb, .inv-table td.cb { width: 30px; min-width: 30px; }
  .inv-table td.cell-clip { max-width: 140px; }
}
.inv-cols-panel { min-width: 190px; max-width: calc(100vw - 32px); }

@media (max-width: 480px) {
  .inv-dd-count { min-width: 16px; height: 16px; font-size: 10px; }
  .btn-ghost, .btn-primary { padding: 7px 12px; font-size: 12px; }
}

/* =========================================================
   P5 集成：SN 查询页 / 扫描历史页 样式
   ========================================================= */

/* SN 查询页 */
.snq-page h2 { font-size: 18px; margin-bottom: 6px; }
.snq-page .desc { margin-bottom: 14px; color: #4b5563; font-size: 13px; }
.dup-toast { display: inline-block; margin-top: 6px; padding: 4px 10px;
  background: #fef7e6; border: 1px solid #f5c26b; border-radius: 5px;
  color: #8a5a00; font-size: 12.5px; animation: dupFade 2.5s forwards; }
@keyframes dupFade { 0%{opacity:0;transform:translateY(-4px)} 10%{opacity:1;transform:none} 80%{opacity:1} 100%{opacity:0} }

.snq-status { display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  font-size: 13px; }
.snq-status .pill { display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 20px; border: 1px solid #d7dee8;
  background: #f7f9fc; color: #1f3a5f; font-size: 12.5px; }
.snq-status .pill.ok { background: #eefaf1; border-color: #b7e3c4; color: #1d6b3a; }
.snq-status .pill.bad { background: #fdeeee; border-color: #f0c2c2; color: #9b2c2c; }
.snq-status .muted { color: #6b7280; font-size: 12.5px; }

.snq-form { display: flex; gap: 8px; margin-bottom: 14px; }
.snq-form input { flex: 0 0 auto; min-width: 300px; padding: 7px 10px;
  border: 1px solid #cfd8e3; border-radius: 7px; font-size: 13px; }
.snq-form button { padding: 7px 16px; border-radius: 7px; cursor: pointer;
  font-size: 13px; border: 1px solid #cfd8e3; background: #fff; color: #1f2937; }
.snq-form button.primary { background: #2b6cb0; border-color: #2b6cb0; color: #fff; }
.snq-form button[disabled] { opacity: .5; cursor: not-allowed; }

.snq-result { background: #fff; border: 1px solid #e6eaf0; border-radius: 8px;
  padding: 16px; margin-bottom: 16px; }
.snq-result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  border-bottom: 1px dashed #eef2f7; padding-bottom: 8px; }
.snq-result-head h3 { margin: 0; font-size: 15px; color: #1f3864; }
.snq-result-head .tag { display: inline-block; padding: 2px 9px; border-radius: 5px;
  font-size: 11px; background: #eef4fb; color: #2b6cb0; }
.snq-result-head .tag.cache { background: #fdf3e3; color: #a3690a; }
.snq-result-head .tag.live { background: #eefaf1; color: #1d6b3a; }
.snq-result-head .muted { color: #6b7280; font-size: 12px; }
.snq-result-grid, .snq-info-grid { display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 14px; }
.snq-field { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.snq-field .k { color: #6b7280; font-size: 12px; font-weight: 600; white-space: nowrap; }
.snq-field .v { color: #1f2937; font-size: 12.8px; word-break: break-all; }
.snq-detail { margin-top: 12px; border-top: 1px dashed #eef2f7; padding-top: 10px; }
.snq-detail summary { cursor: pointer; color: #2b6cb0; font-size: 12.5px;
  padding: 4px 0; }
.snq-info-grid { margin-top: 10px; }

.snq-recent { background: #fff; border: 1px solid #e6eaf0; border-radius: 8px;
  padding: 14px; }
.snq-recent h3 { margin: 0 0 8px; font-size: 14px; color: #1f3864; }
.snq-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.snq-table th, .snq-table td { padding: 6px 9px; text-align: left;
  border-bottom: 1px solid #eef2f7; }
.snq-table thead th { background: #f1f5f9; color: #1f3864; font-weight: 700; }
.snq-table tbody tr { cursor: pointer; }
.snq-table tbody tr:hover td { background: #f8fafc; }

/* SN 查询交互页：查询区 / 进度条 / 汇总列表 / 工具栏 / 箱号弹窗 */
.snq-query { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.snq-block { flex: 1 1 320px; background: #fff; border: 1px solid #e6eaf0;
  border-radius: 8px; padding: 12px 14px; }
.snq-block label { display: block; font-size: 13px; font-weight: 600;
  color: #1f3864; margin-bottom: 8px; }
.snq-block .snq-form { margin-bottom: 6px; }
.snq-block .snq-form input[type="file"] { flex: 1 1 auto; font-size: 12.5px; }

.snq-progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.snq-progress .bar { flex: 1; height: 8px; background: #eef2f7; border-radius: 5px;
  overflow: hidden; }
.snq-progress .fill { height: 100%; background: #2b6cb0; transition: width .15s; }

.snq-summary { background: #fff; border: 1px solid #e6eaf0; border-radius: 8px;
  padding: 12px 14px; }
.snq-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px; }
.snq-toolbar .cb { display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: #1f2937; cursor: pointer; }
.snq-toolbar .cb input { margin: 0; }
.snq-toolbar .sp { flex: 1; }
.snq-toolbar button { padding: 6px 14px; border-radius: 7px; cursor: pointer;
  border: 1px solid #cfd8e3; background: #fff; font-size: 12.5px; }
.snq-toolbar button.primary { background: #2b6cb0; border-color: #2b6cb0; color: #fff; }
.snq-toolbar button[disabled] { opacity: .5; cursor: not-allowed; }

.snq-summary-table { width: 100%; min-width: 100%; border-collapse: collapse; font-size: 12.5px; }
.snq-summary-table th, .snq-summary-table td { padding: 6px 9px; text-align: left;
  border-bottom: 1px solid #f1f5f9; vertical-align: middle; white-space: normal; }
/* 表格滚动容器：内容超出时才出滚动条；表头 sticky 固定不随内容滚 */
.snq-table-wrap { overflow: auto; max-height: 62vh; scrollbar-width: thin; scrollbar-color: #c7ced8 #f1f5f9; }
.snq-summary-table thead th { background: #f1f5f9; color: #1f3864; font-weight: 700;
  white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.snq-summary-table th.cb, .snq-summary-table td.cb { width: 34px; text-align: center; }
/* 批次号：超长截断省略（不撑宽列/撑高行）；时间/型号列：单行不换行 */
.snq-summary-table .col-batch { max-width: 160px; }
.snq-summary-table .col-nowrap { white-space: nowrap; }
.snq-summary-table .cell-clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 滚动条样式（与系统浅色风格一致，Webkit 内核） */
.snq-table-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.snq-table-wrap::-webkit-scrollbar-track { background: #f1f5f9; }
.snq-table-wrap::-webkit-scrollbar-thumb { background: #c7ced8; border-radius: 6px; border: 2px solid #f1f5f9; }
.snq-table-wrap::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.snq-summary-table td.cb input { margin: 0; }
.snq-summary-table tbody tr.sel td { background: #f0f6ff; }
.snq-summary-table tbody tr:hover td { background: #f8fafc; }
.snq-summary-table .tag.live { display: inline-block; padding: 1px 7px;
  border-radius: 4px; background: #eefaf1; color: #1d6b3a; font-size: 11px; }
.empty-tip { padding: 18px 0; }

.snq-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .4);
  display: flex; align-items: center; justify-content: center; z-index: 50; }
.snq-modal-card { background: #fff; border-radius: 10px; padding: 18px 20px;
  min-width: 340px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.snq-modal-card h3 { margin: 0 0 8px; font-size: 15px; color: #1f3864; }
.snq-modal-card input { width: 100%; box-sizing: border-box; padding: 7px 10px;
  border: 1px solid #cfd8e3; border-radius: 7px; font-size: 13px; margin: 6px 0; }
.snq-modal-card .btn-row { margin-top: 8px; }

/* 筛选区 + 显示字段下拉 */
.snq-filter { display: flex; align-items: center; gap: 6px; }
.snq-filter select { padding: 6px 8px; font-size: 12.5px; border: 1px solid #d1d5db;
  border-radius: 6px; background: #fff; color: #1f2937; }
.snq-filter input { min-width: 180px; padding: 6px 8px; font-size: 12.5px;
  border: 1px solid #d1d5db; border-radius: 6px; }
.snq-filter button { padding: 6px 12px; border-radius: 6px; cursor: pointer;
  background: #eef2f7; border: 1px solid #e6eaf0; font-size: 12.5px; color: #1f2937; }
.snq-filter button:hover { background: #e2e8f0; }

.snq-cols { position: relative; z-index: 25; }
.snq-cols > button { padding: 6px 12px; border-radius: 6px; cursor: pointer;
  background: #eef2f7; border: 1px solid #e6eaf0; font-size: 12.5px; color: #1f2937; }
.snq-cols > button:hover { background: #e2e8f0; }
.snq-cols-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  background: #fff; border: 1px solid #e6eaf0; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12); padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px; min-width: 160px;
}
.snq-cols-panel .cb { display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; cursor: pointer; padding: 3px 0; color: #1f2937; }
.snq-cols-panel .cb input { margin: 0; }
.snq-cols-backdrop { position: fixed; inset: 0; z-index: 15; }

/* 行展开详情区（点击行查看全部原始字段） */
.snq-summary-table tbody tr { cursor: pointer; }
.snq-summary-table tbody tr.snq-detail-row td {
  background: #f8fafc; padding: 10px 14px; border-bottom: 1px solid #eef2f7;
}
.snq-summary-table .snq-info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px 18px;
}
.snq-summary-table .snq-field { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.snq-summary-table .snq-field .k {
  color: #6b7280; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.snq-summary-table .snq-field .v {
  color: #1f2937; font-size: 12.5px; word-break: break-all;
}

/* 扫描历史页 */
/* 整页占满内容区并采用纵向 flex：标题/筛选/分页固定，仅表格区域内部滚动 */
.scanh-page { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.scanh-page > h2,
.scanh-page > .desc,
.scanh-page > .inv-searchbar,
.scanh-page > .inv-filterbar,
.scanh-page > .scanh-chips,
.scanh-page > .scanh-batchbar,
.scanh-page > .err,
.scanh-page > .dash-loading,
.scanh-page > .dash-empty,
.scanh-page > .scanh-pager { flex-shrink: 0; }
.scanh-page h2 { font-size: 18px; margin-bottom: 6px; }
.scanh-page .desc { margin-bottom: 14px; color: #4b5563; font-size: 13px; }

.scanh-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; margin-bottom: 8px; }
.scanh-tools .sp { flex: 1; }
.scanh-tools input { padding: 6px 9px; border: 1px solid #cfd8e3;
  border-radius: 7px; font-size: 13px; }
.scanh-tools button { padding: 6px 14px; border-radius: 7px; cursor: pointer;
  font-size: 13px; border: 1px solid #cfd8e3; background: #fff; color: #1f2937; }
.scanh-tools button.primary { background: #2b6cb0; border-color: #2b6cb0; color: #fff; }

.scanh-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.scanh-chips .chip { border: 1px solid #cfd8e3; background: #fff; border-radius: 999px;
  padding: 5px 13px; font-size: 12.5px; cursor: pointer; color: #42566b;
  display: inline-flex; align-items: center; gap: 4px; }
.scanh-chips .chip.on { background: #2b6cb0; border-color: #2b6cb0; color: #fff; }
.scanh-chips .chip small { opacity: .75; margin-left: 4px; }
/* 天山同步状态（chips 行右侧）与同步按钮 */
.scanh-syncinfo { margin-left: auto; align-self: center; font-size: 12px;
  color: #64748b; display: inline-flex; align-items: center; gap: 4px; }
.scanh-syncinfo small { color: #94a3b8; }
.scanh-sync-btn { white-space: nowrap; }
.scanh-sync-btn:disabled { opacity: .6; cursor: default; }

/* 唯一纵向滚动容器：吃掉剩余高度，内容超出时仅此处出滚动条 */
.scanh-tblwrap { flex: 1 1 auto; min-height: 120px; overflow: auto; position: relative;
  border-radius: 8px; border: 1px solid #e6eaf0; background: #fff; }
.scanh-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.scanh-table th, .scanh-table td { padding: 5px 9px; text-align: left;
  border-bottom: 1px solid #eef2f7; white-space: nowrap; }
.scanh-table thead th { background: #f1f5f9; color: #1f3864; font-weight: 700;
  position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 #d8dee8; }
.scanh-table tbody tr:hover td { background: #f8fafc; }
.scanh-table .r-ok { color: #2e7d32; }
.scanh-table .r-blank { color: #8b98a6; }
.scanh-table .r-fail { color: #c0392b; }

/* 箱号列：值截断省略 + 行内编辑按钮（双向同步入口） */
.scanh-table .box-cell { display: inline-flex; align-items: center; gap: 5px;
  max-width: 150px; }
.scanh-table .box-cell > span { overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.scanh-table .box-edit { border: none; background: none; cursor: pointer;
  color: #94a3b8; font-size: 12px; padding: 0 2px; line-height: 1; }
.scanh-table .box-edit:hover { color: #2b6cb0; }

/* 弹窗内同步成功提示 */
.ok-msg { color: #2e7d32; font-size: 13px; margin: 6px 0 0; }

.scanh-pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; font-size: 13px; color: #4b5563; }
.scanh-pager button { padding: 6px 14px; border-radius: 7px; cursor: pointer;
  font-size: 13px; border: 1px solid #cfd8e3; background: #fff; color: #1f2937; }
.scanh-pager button[disabled] { opacity: .5; cursor: not-allowed; }
.scanh-page-info { white-space: nowrap; }

/* ============ 批量操作 ============ */
/* 复选框列 */
.scanh-table th.cb, .scanh-table td.cb { width: 36px; min-width: 36px;
  text-align: center; padding-left: 6px; padding-right: 6px; }
.scanh-table th.cb input, .scanh-table td.cb input { width: 15px; height: 15px;
  accent-color: #2b6cb0; cursor: pointer; vertical-align: middle; }
/* 选中行高亮（覆盖 hover） */
.scanh-table tbody tr.row-selected td { background: #eaf3ff; }
.scanh-table tbody tr.row-selected:hover td { background: #dbeafe; }

/* 批量操作工具栏 */
.scanh-batchbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
  padding: 9px 14px; margin-bottom: 12px; }
.scanh-batch-info { font-size: 13.5px; color: #1e3a8a; }
.scanh-batch-info b { color: #1d4ed8; font-size: 15px; margin: 0 2px; }
.scanh-batch-info small { color: #64748b; margin-left: 4px; }
.scanh-batch-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.scanh-batch-actions button { padding: 6px 13px; border-radius: 7px; cursor: pointer;
  font-size: 13px; border: 1px solid transparent; white-space: nowrap; }
.scanh-btn-danger { background: #dc2626; color: #fff; }
.scanh-btn-danger:hover { background: #b91c1c; }
.scanh-btn-primary { background: #2b6cb0; color: #fff; }
.scanh-btn-primary:hover { background: #245a94; }
.scanh-btn-warn { background: #d97706; color: #fff; }
.scanh-btn-warn:hover { background: #b45309; }
.scanh-btn-ghost { background: #fff; color: #475569; border-color: #cbd5e1 !important; }
.scanh-btn-ghost:hover { background: #f1f5f9; }

/* 批量操作弹窗 */
.snq-modal-card.scanh-batch-card { min-width: 420px; max-width: 520px; }
.scanh-mark-form { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.scanh-mark-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.scanh-mark-row > span { width: 64px; flex-shrink: 0; color: #475569; font-weight: 600; }
.scanh-mark-row select, .scanh-mark-row input { flex: 1; padding: 7px 10px;
  border: 1px solid #d6dbe4; border-radius: 6px; font-size: 13.5px; box-sizing: border-box; }
.scanh-confirm-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 12px 14px; margin-top: 10px; }
.scanh-confirm-main { margin: 0 0 8px; font-size: 14px; color: #1f2937; }
.scanh-confirm-main .warn { color: #dc2626; font-size: 16px; }
.scanh-confirm-detail { margin: 0 0 8px; font-size: 13px; color: #475569; line-height: 1.6; }
.scanh-confirm-tip { margin: 0; font-size: 12.5px; color: #b91c1c; }

/* 进度条 */
.scanh-progress-wrap { padding: 18px 4px 6px; }
.scanh-progress-bar { height: 10px; background: #eef2f7; border-radius: 6px; overflow: hidden; }
.scanh-progress-bar .fill { height: 100%; width: 0; background: linear-gradient(90deg,#3b82f6,#2b6cb0);
  border-radius: 6px; transition: width .15s ease; }
.scanh-progress-wrap .muted { margin-top: 10px; text-align: center; font-size: 13px; }

/* 结果反馈 */
.scanh-result-box { margin-top: 10px; }
.scanh-result-main { margin: 0 0 6px; font-size: 14px; }
.warn-msg { color: #b45309; font-size: 13.5px; font-weight: 600; }
.scanh-fail-list { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 10px 14px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.scanh-fail-head { margin: 0 0 6px; font-size: 13px; color: #92400e; font-weight: 700; }
.scanh-fail-list ul { margin: 0; padding-left: 18px; }
.scanh-fail-list li { font-size: 12.5px; color: #78350f; line-height: 1.7; }

/* 移动端适配 */
@media (max-width: 640px) {
  .scanh-batchbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
  .scanh-batch-info { text-align: center; }
  .scanh-batch-actions { margin-left: 0; justify-content: center; }
  .scanh-batch-actions button { flex: 1; padding: 8px 6px; font-size: 12.5px; }
  .snq-modal-card.scanh-batch-card { min-width: 0; width: calc(100vw - 32px);
    max-width: none; padding: 14px; }
  .scanh-mark-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .scanh-mark-row > span { width: auto; }
  .scanh-table th.cb, .scanh-table td.cb { width: 30px; min-width: 30px; }
  /* 窄屏压缩顶部固定区，给表格滚动区留足高度 */
  .scanh-page .desc { margin-bottom: 8px; font-size: 12px; line-height: 1.45; }
  .scanh-page > .inv-searchbar { padding: 8px 10px; margin-bottom: 8px; }
  .scanh-page > .inv-filterbar { margin-bottom: 8px; }
  .scanh-chips { margin-bottom: 8px; }
  .scanh-pager { margin-top: 8px; }
  .scanh-tblwrap { min-height: 96px; }
}

/* =========================================================
   数据获取页（功能 2/3 合并：BI 导出 + 今日出入库清单）
   命名空间 .df- 前缀，不覆盖全局通用类
   ========================================================= */
.df-page { max-width: 960px; }
.df-head h2 { font-size: 20px; margin-bottom: 6px; }
.df-head .desc { margin-bottom: 18px; max-width: 760px; }

/* 分段式 Tab 控制器 */
.df-tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: #e8edf4; border-radius: 10px; margin-bottom: 16px;
}
.df-tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 20px; border: none; border-radius: 8px;
  background: transparent; color: #475569;
  font-size: 13.5px; font-weight: 600;
  transition: color .22s ease, background .22s ease, box-shadow .22s ease;
}
.df-tab:hover { color: #1f3864; background: rgba(255, 255, 255, .65); }
.df-tab.active {
  background: #fff; color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
  cursor: default;
}
.df-tab-ico { font-size: 15px; line-height: 1; }
.df-tab-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2);
  animation: df-pulse 1.6s ease-in-out infinite;
}
@keyframes df-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* 模块卡片 */
.df-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  overflow: hidden;
}
.df-mod-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #fbfdff 0%, #fff 100%);
}
.df-mod-ico {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
}
.df-mod-ico.bi { background: #dbeafe; }
.df-mod-ico.stock { background: #dcfce7; }
.df-mod-txt { min-width: 0; }
.df-mod-txt h3 { font-size: 15.5px; color: #1f2937; margin-bottom: 3px; }
.df-mod-txt p { font-size: 12.5px; color: #6b7280; line-height: 1.5; }
.df-mod-head .badge { margin-left: auto; flex-shrink: 0; }

.df-mod-body { padding: 20px 22px; }

/* 参数栅格：自适应等宽，窄屏自动单列 */
.df-params {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 18px; margin-bottom: 16px;
}
.df-field { display: flex; flex-direction: column; gap: 6px; }
.df-field-label { font-size: 12.5px; font-weight: 600; color: #475569; }
.df-field-label .req { margin-left: 2px; }
.df-field input, .df-field select { width: 100%; }
.df-field input[type="file"] { padding: 6px; }

.df-noargs {
  display: flex; align-items: center; gap: 8px;
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 14px;
  color: #64748b; font-size: 13px;
}

.df-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.df-run {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 24px; font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease;
}
.df-run:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.df-run-hint { font-size: 12.5px; }

/* 最近任务结果区 */
.df-result {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px dashed #e5e7eb;
}
.df-result-head { margin-bottom: 10px; font-size: 12.5px; }
.df-outputs { margin-top: 14px; }
.df-outputs h4 { font-size: 13px; color: #374151; margin-bottom: 8px; }
.df-output {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 6px;
  border: 1px solid #e5e7eb; border-radius: 8px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.df-output:hover {
  border-color: #93c5fd; background: #f8fbff;
  text-decoration: none; transform: translateX(2px);
}
.df-output-ico { font-size: 15px; flex-shrink: 0; }
.df-output-name { font-size: 13px; color: #1f2937; word-break: break-all; }
.df-output-dl {
  margin-left: auto; flex-shrink: 0;
  font-size: 12px; font-weight: 600; color: #2563eb;
}

/* Tab 面板切换过渡（淡入 + 轻微位移） */
.df-fade-enter-active, .df-fade-leave-active { transition: opacity .22s ease, transform .22s ease; }
.df-fade-enter-from { opacity: 0; transform: translateY(8px); }
.df-fade-leave-to { opacity: 0; transform: translateY(-6px); }
/* 结果区展开过渡 */
.df-expand-enter-active { transition: opacity .25s ease; }
.df-expand-enter-from { opacity: 0; }

@media (max-width: 768px) {
  .df-tabs { display: flex; width: 100%; }
  .df-tab { flex: 1; justify-content: center; padding: 8px 10px; font-size: 12.5px; }
  .df-mod-head { padding: 14px 16px; gap: 10px; }
  .df-mod-ico { width: 36px; height: 36px; font-size: 17px; }
  .df-mod-txt p { font-size: 12px; }
  .df-mod-body { padding: 16px; }
  .df-params { grid-template-columns: 1fr; gap: 12px; }
  .df-run { width: 100%; justify-content: center; }
}

/* =========================================================
   回收自检单页（功能5：上传/预览/补全/建单+改属性/结果）
   命名空间 .rc- 前缀，不覆盖全局通用类
   ========================================================= */
.rc-page { max-width: 1200px; }
.rc-single-sn { width: 340px; font-family: Consolas, "Courier New", monospace; }
.rc-toolbar {
  display: flex; flex-direction: column; gap: 10px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 12px 14px; margin: 14px 0 10px;
}
.rc-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rc-filters input { width: 200px; }
.rc-filters select { max-width: 190px; }
.rc-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  border-top: 1px dashed #eef2f7; padding-top: 10px;
}
.rc-actions .danger { margin-left: auto; }
.rc-mini {
  padding: 5px 12px; font-size: 12.5px; border: 1px solid #cbd5e1;
  background: #fff; color: #334155; border-radius: 6px; cursor: pointer;
}
.rc-mini:hover:not(:disabled) { border-color: #93c5fd; color: #1d4ed8; background: #f8fbff; }
.rc-mini:disabled { opacity: .5; cursor: not-allowed; }
.rc-assign {
  padding: 5px 8px; font-size: 12.5px; border-radius: 6px;
  border: 1px solid #cbd5e1; background: #fff;
}

.rc-progress {
  font-size: 12.5px; color: #1d4ed8; background: #eff6ff;
  border: 1px solid #bfdbfe; border-radius: 8px; padding: 8px 12px;
  margin-bottom: 10px;
}

/* 表格容器：表头固定、内容在容器内滚动，不触发整页滚动 */
.rc-tblwrap {
  overflow: auto; max-height: 60vh; border: 1px solid #e5e7eb;
  border-radius: 8px; background: #fff;
  scrollbar-width: thin; scrollbar-color: #c7ced8 #f1f5f9;
}
.rc-tblwrap-sm { max-height: 320px; margin: 10px 0; }
.rc-table { width: 100%; min-width: max-content; border-collapse: collapse; font-size: 12.8px; }
.rc-table th, .rc-table td {
  padding: 7px 10px; border-bottom: 1px solid #eef2f7;
  text-align: left; white-space: nowrap;
}
.rc-table thead th {
  background: #f1f5f9; color: #1f3864; font-weight: 700;
  position: sticky; top: 0; z-index: 2;
  box-shadow: inset 0 -1px 0 #d8dee8;
}
.rc-table tbody tr:hover td { background: #f8fafc; }
.rc-table tbody tr.row-selected td { background: #eaf3ff; }
.rc-table tbody tr.rc-fail td { background: #fff1f2; }
.rc-table th.cb, .rc-table td.cb { width: 36px; min-width: 36px; padding: 7px 6px; }
.rc-table th.cb input, .rc-table td.cb input { width: 15px; height: 15px; margin: 0; cursor: pointer; }
.rc-table td.rc-sn { font-family: Consolas, "Courier New", monospace; }
.rc-empty { text-align: center; padding: 20px; }
.rc-warn { color: #b45309; }
.rc-badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; }
.rc-badge.ok { background: #dcfce7; color: #15803d; }
.rc-badge.warn { background: #fef3c7; color: #b45309; }
.rc-badge.fail { background: #fee2e2; color: #b91c1c; }

.rc-pager { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }

/* 结果区 */
.rc-result { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e5e7eb; }
.rc-result h4 { font-size: 13px; margin-bottom: 8px; }
.rc-failbox {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 10px 14px; margin-top: 12px;
}
.rc-failhead {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px; font-size: 13px; color: #92400e;
}
.rc-fail-list { max-height: 240px; overflow-y: auto; }
.rc-fail-item {
  display: flex; gap: 12px; font-size: 12.5px; color: #78350f;
  padding: 3px 0; line-height: 1.6;
}
.rc-fail-item .rc-sn { flex-shrink: 0; }

/* 二次确认弹窗 */
.rc-modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.rc-modal {
  background: #fff; border-radius: 12px; padding: 20px 22px;
  width: min(460px, calc(100vw - 40px));
  box-shadow: 0 10px 40px rgba(15, 23, 42, .3);
}
.rc-modal h3 { font-size: 16px; margin-bottom: 10px; }
.rc-modal p { font-size: 13.5px; color: #475569; line-height: 1.7; margin-bottom: 14px; }

@media (max-width: 640px) {
  .rc-actions { flex-direction: column; align-items: stretch; }
  .rc-actions .danger { margin-left: 0; }
  .rc-filters input { width: 100%; }
  .rc-tblwrap { max-height: 50vh; }
}

/* ===== 物资情况看板（MaterialDashboardPage，功能8 输出可视化） ===== */
.mat-page { max-width: 1600px; }
.mat-page h2 { font-size: 18px; margin-bottom: 6px; }

/* 数据源工具条（DB 化改造：周期区间控件 + 立即更新 + 核查状态条） */
.mat-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid #e6eaf0; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.mat-pick {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: #4b5563;
}
.mat-pick select { min-width: 300px; max-width: 460px; }
.mat-pick input[type="date"] {
  padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 13px; color: #374151; background: #fff;
}
.mat-meta { font-size: 12px; }

/* 快捷区间胶囊 */
.mat-quick { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* 核查/数据健全状态条（周末缺失不提示，只列缺失工作日） */
.mat-verify {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: #6b7280;
  background: #f8fafc; border: 1px solid #e6eaf0; border-left: 3px solid #cbd5e1;
  border-radius: 6px; padding: 8px 12px; margin: -6px 0 14px;
}
.mat-verify.busy { color: #1d4ed8; background: #eff6ff; border-left-color: #2563eb; }
.mat-verify-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; flex: none;
}
.mat-verify.busy .mat-verify-dot {
  background: #2563eb; animation: mat-verify-pulse 1s ease-in-out infinite;
}
@keyframes mat-verify-pulse { 50% { opacity: .25; } }

/* 概览指标卡片：复用 .dash-card 视觉 */
.mat-kpis { margin-bottom: 14px; }
.mat-kpis .dash-card { flex: 1 1 180px; }

/* 图表区：随宽度自适应排列 */
.mat-charts {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* 筛选条 */
.mat-filterbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.mat-filterbar > label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: #4b5563;
}
.mat-filterbar input[type="text"] { min-width: 180px; }
.mat-filterbar select { max-width: 200px; }
.mat-check { cursor: pointer; user-select: none; }
.mat-check input { width: 15px; height: 15px; cursor: pointer; }

/* 物资大类胶囊选择 */
.mat-chips {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px;
}
.mat-chips-label { font-size: 12px; color: #6b7280; }
.mat-chip {
  padding: 3px 10px; border-radius: 999px; border: 1px solid #d1d5db;
  background: #fff; color: #4b5563; font-size: 12px; line-height: 1.6;
}
.mat-chip:hover { border-color: #93c5fd; color: #1d4ed8; }
.mat-chip.on {
  background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; font-weight: 600;
}

/* 表格容器：仅容器内滚动 + 表头固定 */
.mat-tblwrap {
  overflow: auto; border: 1px solid #e6eaf0; border-radius: 8px; background: #fff;
  scrollbar-width: thin; scrollbar-color: #c7ced8 #f1f5f9;
}
.mat-statwrap { max-height: 62vh; }
.mat-detailwrap { max-height: 56vh; }
.mat-stat-table { min-width: max-content; }
.mat-stat-table thead th { position: sticky; background: #f1f5f9; z-index: 3; }
.mat-stat-table thead tr:nth-child(1) th { top: 0; }
.mat-stat-table thead tr:nth-child(2) th { top: 32px; }
/* 两层 thead 都是 sticky top 固定后，border-collapse 不再生效，
   两层之间和 thead→tbody 之间的 border 会各渲染一条形成 2px 缝。
   修法：sticky 行保留 border-bottom（border 在背景之上，不会被盖住），
   去掉相邻行的对应 border，确保只有一条 1px 线。
   注意：不能用 box-shadow 替代 border，因为 box-shadow 会被下方元素背景盖住。 */
.mat-stat-table thead tr:nth-child(1) th {
  border-top: none; /* 容器顶部不需要 border */
  border-bottom: 1px solid #e6eaf0;
}
.mat-stat-table thead tr:nth-child(2) th {
  border-top: none; /* 去掉，避免和 R0 border-bottom 双显 */
  border-bottom: 1px solid #e6eaf0;
}
.mat-stat-table tbody tr:first-child td { border-top: none; }
/* 边缘 case：首行刚好是区县组首行（gstart），也要压掉 2px 分组 border-top */
.mat-stat-table tbody tr.gstart:first-child td { border-top: none; }
/* tfoot 是 sticky bottom，处理上边缘避免与 tbody 末行 border 双显。
   保留 tfoot 的 2px 强调色 border-top，去掉 tbody 末行 border-bottom */
.mat-stat-table tbody tr:last-child td { border-bottom: none; }
.mat-stat-table th.mat-th-l { text-align: left; }
.mat-owner { font-weight: 700; color: #1f3864; }
.mat-wh { text-align: left !important; }
.mat-stat-table tbody tr.gstart td { border-top: 2px solid #dbe3ee; }
.mat-stat-table tbody tr:hover td { background: #f8fafc; }
.mat-detail-table { min-width: max-content; }
.mat-detail-table thead th { position: sticky; top: 0; z-index: 3; background: #f1f5f9; border-top: none; border-bottom: 1px solid #e6eaf0; }
.mat-detail-table tbody tr:first-child td { border-top: none; }
.mat-detail-table tbody tr:nth-child(even) td { background: #fbfcfe; }
.mat-detail-table tbody tr:hover td { background: #eaf3ff; }
.mat-detail-table td.ellip {
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 可排序表头 */
.mat-sortable { cursor: pointer; user-select: none; }
.mat-sortable:hover { color: #1d4ed8; }
.mat-sortable.active { color: #1d4ed8; background: #e8f0fe; }
.mat-sort-ic { margin-left: 4px; font-size: 11px; color: #94a3b8; }
.mat-sortable.active .mat-sort-ic { color: #1d4ed8; }

/* 判定结果徽标 */
.jb {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.jb-use { background: #dcfce7; color: #15803d; }
.jb-repair { background: #dbeafe; color: #1d4ed8; }
.jb-scrap { background: #ffedd5; color: #c2410c; }
.jb-move { background: #ede9fe; color: #6d28d9; }
.jb-noncons { background: #ffe4e6; color: #be123c; }
.jb-pend { background: #f3f4f6; color: #4b5563; }

/* 分页 */
.mat-pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 12px; font-size: 13px; color: #4b5563;
}

/* 响应式：窄屏图表纵向堆叠、筛选条换行 */
@media (max-width: 900px) {
  .mat-charts { grid-template-columns: 1fr; }
  .mat-pick select { min-width: 200px; max-width: 100%; }
  .mat-pick input[type="date"] { max-width: 100%; }
  .mat-verify { margin-top: -2px; }
}
@media (max-width: 560px) {
  .mat-kpis .dash-card { flex: 1 1 45%; }
  .mat-toolbar { padding: 10px 12px; gap: 8px; }
  .mat-filterbar { gap: 8px; }
  .mat-filterbar input[type="text"] { min-width: 140px; }
  .mat-statwrap, .mat-detailwrap { max-height: 48vh; }
}

/* ===== 周期统计模块 页面组织优化（2026-10-19 一期） ===== */

/* A 区：周期筛选栏吸顶（侧栏布局 main 区有 padding，负 margin 抵消后吸顶） */
.mat-sticky-bar {
  position: sticky; top: -16px; z-index: 20;
  background: #fff;
}

/* B2 判定构成组合卡：紧凑横条 + 点击下钻 */
.mat-distcard {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  background: #fff; border: 1px solid #e8edf5; border-radius: 10px;
  padding: 8px 14px; margin-bottom: 14px; font-size: 13px; color: #4b5563;
}
.mat-distcard-label { font-weight: 600; color: #1f3864; }
.mat-dist-item {
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.mat-dist-item:hover { background: #f1f5f9; }
.mat-dist-item b { color: #111827; }

/* 折叠标题（C/E 区通用）：箭头旋转 + 手型 */
.mat-collapse-title { cursor: pointer; user-select: none; }
.mat-collapse-title:hover { color: #1d4ed8; }
.mat-arrow {
  display: inline-block; margin-right: 4px; font-size: 11px;
  transition: transform .2s ease; color: #64748b;
}
.mat-arrow.open { transform: rotate(90deg); }

/* C 区：图表 2:1 布局（区域对比宽 / 大类 Top15 窄） */
.mat-charts-2 { grid-template-columns: 2fr 1fr; }

/* D 区：大类分组 chips（组名可折叠，组内 chips 跟随显隐） */
.mat-catgroup {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 2px 8px 2px 2px; border: 1px dashed #e2e8f0; border-radius: 8px;
}
.mat-catgroup-name {
  cursor: pointer; user-select: none; font-size: 12px; color: #475569;
  font-weight: 600; padding: 2px 6px; border-radius: 6px;
}
.mat-catgroup-name:hover { background: #f1f5f9; color: #1d4ed8; }

/* D 区：冻结前三列（区县/仓库/装维）。宽度与 left 偏移单点维护 */
.mat-stat-table th.mat-fox0, .mat-stat-table td.mat-fox0 {
  position: sticky; left: 0; min-width: 92px; max-width: 92px; z-index: 2;
}
.mat-stat-table th.mat-fox1, .mat-stat-table td.mat-fox1 {
  position: sticky; left: 92px; min-width: 170px; max-width: 170px; z-index: 2;
}
.mat-stat-table th.mat-fox2, .mat-stat-table td.mat-fox2 {
  position: sticky; left: 262px; min-width: 84px; max-width: 84px; z-index: 2;
}
/* 冻结列底色必须不透明，否则横滚时下方数字透出 */
.mat-stat-table td.mat-fox0, .mat-stat-table td.mat-fox1,
.mat-stat-table td.mat-fox2 { background: #fff; }
.mat-stat-table thead th.mat-fox0, .mat-stat-table thead th.mat-fox1,
.mat-stat-table thead th.mat-fox2 { z-index: 4; background: #f1f5f9; }
/* 汇总/合计/悬停行冻结列同步底色（防透出） */
.mat-stat-table tbody tr.summary td { background: #f4f8fd; font-weight: 600; }
.mat-stat-table tbody tr.summary td.mat-fox0,
.mat-stat-table tbody tr.summary td.mat-fox1,
.mat-stat-table tbody tr.summary td.mat-fox2 { background: #f4f8fd; }
.mat-stat-table tfoot tr.total td.mat-fox0,
.mat-stat-table tfoot tr.total td.mat-fox1,
.mat-stat-table tfoot tr.total td.mat-fox2 { background: #fffbeb; }
.mat-stat-table tbody tr:hover td.mat-fox0,
.mat-stat-table tbody tr:hover td.mat-fox1,
.mat-stat-table tbody tr:hover td.mat-fox2 { background: #f8fafc; }
/* 冻结右缘分界阴影，提示可横滚；thead 有 border-bottom 不需要向下阴影 */
.mat-stat-table td.mat-fox2 { box-shadow: 4px 0 5px -3px rgba(100, 116, 139, .35); }
.mat-stat-table thead th.mat-fox2 { box-shadow: 4px 0 5px -3px rgba(100, 116, 139, .35); }
/* 仓库名列允许换行（冻结列定宽） */
.mat-stat-table td.mat-fox1 { white-space: normal; line-height: 1.3; }

/* 区县组折叠：组首行区县名可点击 */
.mat-owner-toggle { cursor: pointer; user-select: none; }
.mat-owner-toggle:hover { color: #1d4ed8; }

/* 可用天数偏紧档（8~10 标黄） */
.mat-stat-table td.amber { color: #b45309; font-weight: 700; }

/* 「有仓库未纳入统计」提示条 */
.mat-excl {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 8px 0 0; padding: 8px 12px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  color: #92400e; font-size: 12.5px; line-height: 1.7;
}
.mat-excl-ico {
  flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px;
  border-radius: 50%; background: #f59e0b; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 16px; text-align: center;
}
.mat-excl-item { cursor: help; }

/* 总计行吸附表底（tfoot 内 sticky；底色沿用 dash-table tr.total 的 #fffbeb） */
.mat-stat-table tfoot td {
  position: sticky; bottom: 0; z-index: 3;
  background: #fffbeb; font-weight: 700; color: #1f3864;
  border-top: 2px solid #c7d5ee;
}

/* E 区：下钻联动提示条 */
.mat-drill {
  margin-left: 10px; font-size: 12px; font-weight: 400; color: #1d4ed8;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px;
  padding: 2px 8px;
}
.mat-drill-x { cursor: pointer; margin-left: 6px; color: #64748b; }
.mat-drill-x:hover { color: #be123c; }

@media (max-width: 900px) {
  .mat-charts-2 { grid-template-columns: 1fr; }
  .mat-sticky-bar { top: -10px; }
}
