/* ===== 设计令牌 ===== */
:root {
  --primary-900: #0f2744;
  --primary-800: #1e3a5f;
  --primary-700: #234876;
  --primary-600: #2563eb;
  --primary-500: #3b82f6;
  --primary-100: #dbeafe;
  --primary-50: #eff6ff;

  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;

  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0284c7;

  --sidebar-w: 268px;
  --sidebar-w-collapsed: 76px;
  --header-h: 60px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(15, 39, 68, 0.06), 0 8px 24px rgba(15, 39, 68, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 39, 68, 0.14);
  --font: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #d7e6f5;
  padding: 40px 24px;
}

.login-bg {
  position: absolute;
  inset: 0;
  background: url("/static/img/login-bg-hq.jpg?v=4") center 40% / cover no-repeat;
}

.login-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  pointer-events: none;
  user-select: none;
}

.login-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-veil-min {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(15,39,68,0.22) 55%, rgba(15,39,68,0.45) 100%);
}

.login-bg-config {
  display: grid;
  grid-template-columns: minmax(200px, 320px) 1fr;
  gap: 18px;
  align-items: start;
}
.login-bg-preview-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  background: #d7e6f5;
  aspect-ratio: 16 / 10;
}
.login-bg-preview-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}
.login-bg-actions .system-hint { margin-top: 0; }

@media (max-width: 768px) {
  .login-bg-config { grid-template-columns: 1fr; }
}

.login-shell {
  position: relative;
  z-index: 2;
  width: min(380px, calc(100vw - 40px));
}

.login-shell-min {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 24px 26px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 48px rgba(15, 39, 68, 0.22);
  backdrop-filter: blur(12px);
}

.site-beian {
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.4;
}

.site-beian a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.site-beian a:hover {
  color: #fff;
  text-decoration: underline;
}

.login-beian {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 2;
  padding: 0 16px;
}

.login-beian a {
  color: rgba(22, 54, 93, 0.85);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.login-beian a:hover {
  color: #0f2744;
}

.sidebar-beian {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-beian a {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
}

.sidebar-beian a:hover {
  color: rgba(255, 255, 255, 0.9);
}

.login-logo-min {
  height: 52px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  margin-bottom: 14px;
  filter: none;
}

.login-title-min {
  margin: 0 0 22px;
  color: #16365d;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: none;
  line-height: 1.45;
  max-width: 20em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.login-title-company {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.login-title-system {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.login-form-min {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-min {
  height: 46px;
  border-radius: 10px !important;
  background: #fff !important;
  border: 1px solid #d7e0ea !important;
  backdrop-filter: none;
  text-align: center;
  font-size: 0.95rem;
  box-shadow: none;
}

.form-min:focus {
  background: #fff !important;
  border-color: rgba(59, 130, 246, 0.7) !important;
}

.btn-min {
  height: 46px;
  border-radius: 10px;
  margin-top: 4px;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-left: -4px;
}

.sidebar-logo-img {
  height: 40px;
  width: auto;
  max-width: 118px;
  object-fit: contain;
  background: transparent !important;
  border-radius: 0;
  padding: 0;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}

.sidebar-logo h1 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.25;
  white-space: nowrap;
  color: #fff;
}

/* ===== 表单 ===== */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control-sm {
  padding: 4px 8px;
  font-size: 0.85rem;
}

.purity-edit-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mat-edit-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-mat-edit {
  padding: 2px 8px;
  font-size: 0.75rem;
  line-height: 1.4;
}

.form-control.mono { font-family: var(--mono); font-size: 1.1rem; letter-spacing: 1px; }
.mono { font-family: var(--mono); }

select.form-control { cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-600);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-700); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }

.btn-outline {
  background: #fff;
  color: var(--primary-700);
  border: 1.5px solid var(--gray-300);
}
.btn-outline:hover { border-color: var(--primary-500); color: var(--primary-600); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-ico svg {
  width: 16px;
  height: 16px;
}

.btn-lg .btn-ico,
.btn-lg .btn-ico svg {
  width: 18px;
  height: 18px;
}

/* ===== 主布局 ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background:
    linear-gradient(180deg, #0b1c33 0%, #102847 45%, #0e2340 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: 8px 0 32px rgba(8, 22, 40, 0.18);
  transition: width 0.2s ease;
}

.sidebar-logo {
  padding: 18px 16px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: relative;
}

.sidebar-collapse-btn {
  position: absolute;
  top: 18px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(147,197,253,0.25);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: #bfdbfe;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.sidebar-collapse-btn svg { width: 16px; height: 16px; }
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

.sidebar-backdrop {
  display: none;
}

/* 桌面收起侧栏 */
.app-layout.sidebar-collapsed {
  --sidebar-w: var(--sidebar-w-collapsed);
}
.app-layout.sidebar-collapsed .sidebar-brand h1,
.app-layout.sidebar-collapsed .sidebar-sub,
.app-layout.sidebar-collapsed .nav-item {
  font-size: 0;
}
.app-layout.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px;
  gap: 0;
}
.app-layout.sidebar-collapsed .nav-group-label {
  height: 1px;
  margin: 8px 8px 4px;
  overflow: hidden;
  color: transparent;
  font-size: 0;
}
.app-layout.sidebar-collapsed .nav-ico {
  /* keep icon visible when label font-size is 0 */
  font-size: 14px;
}
.app-layout.sidebar-collapsed .user-info > div:last-child,
.app-layout.sidebar-collapsed .logout-btn {
  display: none;
}
.app-layout.sidebar-collapsed .user-info { justify-content: center; margin-bottom: 0; }
.app-layout.sidebar-collapsed .sidebar-logo { padding: 14px 8px; text-align: center; }
.app-layout.sidebar-collapsed .sidebar-brand { justify-content: center; }
.app-layout.sidebar-collapsed .sidebar-logo-img { width: 36px; height: auto; }
.app-layout.sidebar-collapsed .sidebar-collapse-btn {
  position: static;
  margin: 10px auto 0;
  display: flex;
  transform: rotate(180deg);
}
.app-layout.sidebar-collapsed .nav-item[data-page]::after {
  /* tooltip via title attr in JS */
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.btn-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: #fff;
  color: var(--primary-800);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:hover { background: var(--gray-50); }

.sidebar-sub {
  margin-top: 8px;
  margin-left: 4px;
  font-size: 0.75rem;
  color: rgba(147, 197, 253, 0.85);
  letter-spacing: 0.5px;
}

.sidebar-logo span { display: none; }

.sidebar-nav { flex: 1; padding: 14px 10px; }

.nav-group-label {
  margin: 14px 10px 6px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(147, 197, 253, 0.55);
  text-transform: none;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: rgba(255,255,255,0.72);
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.2s;
  margin-bottom: 4px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.nav-ico {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(147,197,253,0.18), rgba(59,130,246,0.08));
  border: 1px solid rgba(147,197,253,0.22);
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 4px 12px rgba(0,0,0,0.12);
}

.nav-item.active .nav-ico {
  background: linear-gradient(145deg, rgba(255,255,255,0.28), rgba(191,219,254,0.15));
  border-color: rgba(255,255,255,0.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 6px 16px rgba(37,99,235,0.35);
}

.nav-ico svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.nav-item .icon { display: none; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
}

.user-info { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

.user-avatar {
  --av-from: #60a5fa;
  --av-to: #1d4ed8;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  isolation: isolate;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  background: linear-gradient(145deg, var(--av-from), var(--av-to));
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.2),
    0 0 0 5px rgba(96, 165, 250, 0.18),
    0 10px 22px rgba(8, 24, 48, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.user-avatar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.45), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
.user-avatar::after {
  content: '';
  position: absolute;
  inset: auto 6px 5px 6px;
  height: 38%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.18), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.user-avatar {
  z-index: 1;
}
.user-info:hover .user-avatar {
  transform: translateY(-1px) scale(1.03);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.28),
    0 0 0 6px rgba(96, 165, 250, 0.28),
    0 12px 26px rgba(8, 24, 48, 0.5);
}

.user-name { font-weight: 600; font-size: 0.88rem; white-space: nowrap; }
.user-role { opacity: 0.7; font-size: 0.75rem; white-space: nowrap; margin-top: 2px; }

.logout-btn {
  color: #fff !important;
  border-color: rgba(255,255,255,0.28) !important;
  background: rgba(255,255,255,0.04) !important;
}
.logout-btn:hover {
  background: rgba(255,255,255,0.1) !important;
  border-color: rgba(255,255,255,0.45) !important;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(59,130,246,0.08), transparent 60%),
    var(--gray-100);
  transition: margin-left 0.2s ease;
  min-width: 0;
}

.top-bar {
  height: var(--header-h);
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar h2 {
  font-size: 1.2rem;
  color: var(--primary-800);
  font-weight: 700;
  letter-spacing: 0.3px;
}

.top-bar-actions { display: flex; align-items: center; gap: 12px; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--primary-700, #1e3a5f);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lang-switch:hover {
  background: var(--primary-50, #eef4fb);
  border-color: var(--primary-200, #c5d6ea);
}
.lang-switch.login-lang {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.workshop-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--primary-50);
  color: var(--primary-700);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--primary-100);
}

.page-body { padding: 24px; flex: 1; }

/* ===== 卡片 ===== */
.card {
  background: rgba(255,255,255,0.92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(8px);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-800);
}

.card-body { padding: 20px; }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: rgba(255,255,255,0.92);
  border-radius: var(--radius-lg);
  padding: 20px 20px 20px 56px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.9);
  position: relative;
  overflow: hidden;
}

.stat-ico {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary-600);
}

.stat-ico svg {
  width: 18px;
  height: 18px;
}

.stat-card.green .stat-ico { background: rgba(5,150,105,0.1); color: var(--success); }
.stat-card.orange .stat-ico { background: rgba(217,119,6,0.1); color: var(--warning); }
.stat-card.red .stat-ico { background: rgba(220,38,38,0.1); color: var(--danger); }
.stat-card.blue .stat-ico { background: rgba(37,99,235,0.1); color: var(--primary-600); }

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.blue::before { background: var(--primary-600); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }

.stat-label { font-size: 0.82rem; color: var(--gray-500); font-weight: 500; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--gray-900); margin-top: 4px; }
.stat-unit { font-size: 0.85rem; color: var(--gray-400); font-weight: 400; }

/* ===== 工位面板 ===== */
.station-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.station-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s;
  cursor: pointer;
}

.station-card.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

.station-card h4 {
  font-size: 1rem;
  color: var(--primary-800);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.station-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-400);
}
.station-status.online { background: var(--success); }

/* ===== 内部作业端 · 称重 ===== */
.ops-terminal-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--primary-600);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.weigh-ops { display: flex; flex-direction: column; gap: 10px; }

.weigh-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 12px;
  align-items: start;
}

.weigh-main-col { min-width: 0; padding-bottom: 88px; }

.weigh-card .card-body,
.weigh-card-body { padding: 12px 14px; }

.ops-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #eef3ff, #f4f7ff);
  border: 1px solid #cedaff;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #334155;
}
.ops-banner-compact { margin-bottom: 8px; }
.ops-banner .stage-tag {
  flex: none;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
}

.procbar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}
.proc {
  position: relative;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  padding: 6px 6px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  min-height: 0;
}
.proc .proc-tx b { font-size: 0.72rem; line-height: 1.2; }
.proc .proc-tx small { display: none; }

/* 底部固定：采集 / 判定，无需下滑 */
.weigh-dock {
  position: sticky;
  bottom: 0;
  z-index: 40;
  margin-top: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
}
.weigh-dock-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
.weigh-dock .action-buttons {
  margin: 0;
  gap: 8px;
}
.weigh-dock .btn-lg {
  min-width: 160px;
  padding: 12px 20px;
  font-size: 1rem;
}

#page-weigh.weighing-mode .ops-guide,
#page-weigh.weighing-mode #recentPassesCard {
  display: none;
}
#page-weigh.weighing-mode .weigh-grid {
  grid-template-columns: 1fr;
}
#page-weigh.weighing-mode .scale-panel-value .value {
  font-size: 3rem;
}
#page-weigh.weighing-mode .unpack-stage p,
#page-weigh.weighing-mode .unpack-stage-hint {
  display: none;
}
#page-weigh.weighing-mode .unpack-layout {
  grid-template-columns: auto 1fr;
  gap: 8px;
}
#page-weigh.weighing-mode .proc-panel {
  padding: 10px 12px;
  margin-bottom: 0;
}

.job-line-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.job-line-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.job-line-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.job-line-tabs::-webkit-scrollbar {
  height: 6px;
}
.job-line-tabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
.job-line-tab {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  flex: 0 0 auto;
  max-width: 168px;
  min-width: 96px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.job-line-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 0.75rem;
  color: #64748b;
}
.job-line-tab .jl-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.job-line-tab .jl-step {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  opacity: 0.85;
  font-weight: 400;
}
.job-line-tab:hover { border-color: #64748b; }
.job-line-tab.active {
  border-color: #1e3a5f;
  background: #1e3a5f;
  color: #fff;
}
.job-line-tab.paused:not(.active) {
  border-color: #d97706;
  background: #fffbeb;
  color: #92400e;
}
.job-line-tab.waiting:not(.active),
.job-line-tab.paused:not(.active) {
  border-color: #d97706;
  background: #fffbeb;
  color: #92400e;
}
.job-line-tab.abort:not(.active) {
  border-color: #dc2626;
  background: #fef2f2;
  color: #991b1b;
}
.job-line-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: none;
}
.job-line-hint {
  display: none;
}

/* 扫码编码规则 */
.scan-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.scan-rule-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}
.scan-rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.scan-rule-hint {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: #64748b;
}
.scan-rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  margin-bottom: 10px;
}
.scan-rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 0.82rem;
}
.scan-rule-chip code {
  font-family: var(--mono, ui-monospace, monospace);
}
.scan-rule-del {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}
.scan-rule-del:hover { color: #dc2626; }
.scan-rule-empty {
  font-size: 0.82rem;
  color: #94a3b8;
}
.scan-rule-add {
  display: flex;
  gap: 8px;
  align-items: center;
}
.scan-rule-add .form-control {
  flex: 1;
  min-width: 0;
}

.scan-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #f5f8fb;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #3a5068;
}
.scan-context strong { color: #1e3a5f; }
.proc {
  min-height: 0;
  padding: 6px;
  border-radius: 8px;
  gap: 5px;
}
.proc .proc-ic {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex: none;
  background: #eef1f7;
  color: #98a4bc;
  font-size: 0.65rem;
  font-weight: 700;
}
.proc .proc-tx { min-width: 0; }
.proc .proc-tx b {
  display: block;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #1e293b;
}
.proc .proc-tx small {
  display: none;
}
.proc.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px #eef3ff;
}
.proc.active .proc-ic { background: #2563eb; color: #fff; }
.proc.done { border-color: #c7e9d6; background: #f2fbf7; }
.proc.done .proc-ic { background: #059669; color: #fff; }
.proc.lock {
  border-style: dashed;
  background: #f7f9fc;
  opacity: 0.62;
}
.proc.fail {
  border-color: #dc2626;
  background: #fdf1f1;
  box-shadow: 0 0 0 3px #fbe3e3;
}
.proc.fail .proc-ic { background: #dc2626; color: #fff; }

.scan-box {
  border: 1.5px dashed #93c5fd;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  background: #fbfdff;
}
.scan-box .scan-ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #eef3ff;
  color: #2563eb;
  display: grid;
  place-items: center;
  flex: none;
}
.scan-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 0;
  min-width: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.scan-box input:focus { outline: none; }

.proc-panel {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  background: #fbfcfe;
  margin: 14px 0;
}
.proc-panel .p-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2563eb;
  background: #eef3ff;
  border-radius: 20px;
  padding: 5px 12px;
  margin-bottom: 12px;
}
.proc-panel .p-badge.red { background: #fbe3e3; color: #dc2626; }
.proc-panel .p-line { font-size: 0.88rem; color: #5b6b85; }
.proc-panel .p-sec {
  font-size: 0.7rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin: 14px 0 8px;
}
.proc-panel .p-readout {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  background: #0d1b2e;
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
}
.proc-panel .p-readout span { font-size: 0.75rem; color: #8ca0c4; }
.proc-panel .p-readout b {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.proc-panel .p-readout .p-delta { font-size: 0.82rem; color: #5ee0a7; }
.proc-panel .p-info { display: flex; gap: 8px; flex-wrap: wrap; }
.proc-panel .p-verdict {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.proc-panel.empty {
  text-align: center;
  color: #94a3b8;
  padding: 28px 16px;
}
.proc-panel.empty .p-hint { display: inline-block; }
.proc-panel.fail { background: #fdf3f3; border-color: #f2c6c6; }
.p-collect-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.p-collect-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: #64748b;
  min-width: 140px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #eef2f7;
  color: #475569;
}
.chip-blue { background: #eef3ff; color: #2563eb; }
.chip-red { background: #fbe3e3; color: #dc2626; }

#ctxMaterial.material-ok { color: #059669; }

.unpack-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 4px;
}
.unpack-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.unpack-side-card {
  background: #0d1b2e;
  border-radius: 10px;
  padding: 12px;
  color: #fff;
  flex: 1;
}
.unpack-side-card span {
  display: block;
  font-size: 0.7rem;
  color: #8ca0c4;
  margin-bottom: 6px;
}
.unpack-side-card strong {
  display: block;
  font-size: 0.92rem;
  font-family: var(--mono, ui-monospace, monospace);
  word-break: break-all;
  line-height: 1.35;
}
.unpack-side-card strong.ok { color: #5ee0a7; }

.unpack-main {
  min-width: 0;
  border: 1px solid #dbe3f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 18px 16px;
  display: flex;
  align-items: center;
}
.unpack-stage { width: 100%; }
.unpack-stage .ush-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  background: #eef3ff;
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 10px;
}
.unpack-stage h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: #0f172a;
}
.unpack-stage p {
  margin: 0;
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.55;
}
.unpack-stage .mono {
  font-family: var(--mono, ui-monospace, monospace);
  color: #1d4ed8;
}
.unpack-stage-hint {
  margin-top: 14px;
  font-size: 0.8rem;
  color: #64748b;
  padding: 8px 10px;
  background: #fff;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
}
.unpack-weigh-readout { margin-top: 14px; }

.modal-danger {
  border: 2px solid #dc2626;
  box-shadow: 0 12px 40px rgba(220, 38, 38, 0.25);
}
.modal-danger .modal-header {
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
}
.modal-danger .modal-header h3 { color: #b91c1c; }
.material-alert-msg {
  color: #991b1b;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 14px;
}
.material-alert-compare {
  display: grid;
  gap: 10px;
}
.material-alert-compare > div {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
}
.material-alert-compare span {
  display: block;
  font-size: 0.75rem;
  color: #9f1239;
  margin-bottom: 4px;
}
.material-alert-compare strong {
  font-family: var(--mono, ui-monospace, monospace);
  color: #7f1d1d;
  word-break: break-all;
}

.wd-tags {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
}
.scale-panel.weigh-display { position: relative; }

.tip-panel {
  background: #0f1c2e;
  color: #cbd5ea;
  border-radius: var(--radius-lg);
  padding: 16px;
  font-size: 0.82rem;
  position: sticky;
  top: 12px;
}
.tip-panel h4 {
  color: #fff;
  font-size: 0.88rem;
  margin: 0 0 10px;
}
.tip-panel .tip-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.tip-panel .tip-item:last-child { border-bottom: none; }
.tip-panel .tip-item b { color: #34d399; display: block; margin-bottom: 2px; }
.tip-panel .tip-item small { display: block; color: #8ca0c4; line-height: 1.4; }

/* 旧步骤条保留兼容，称重页已改用 procbar */
.ops-steps { display: none; }

.weigh-main-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}

.ops-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  color: var(--gray-400);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.ops-step-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  font-size: 0.78rem;
  color: var(--gray-500);
}

.ops-step.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
  color: var(--primary-700);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.ops-step.active .ops-step-ico {
  background: var(--primary-600);
  color: #fff;
}
.ops-step.done { color: var(--success); }
.ops-step.done .ops-step-ico {
  background: var(--success-bg);
  color: var(--success);
}

.ops-step-line {
  width: 28px;
  height: 2px;
  background: var(--gray-200);
  flex-shrink: 0;
  margin: 0 4px;
}

.ops-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, #1d4ed8, #2563eb 55%, #3b82f6);
  color: #fff;
}
.ops-banner strong { font-size: 0.95rem; }
.ops-banner span { font-size: 0.8rem; opacity: 0.92; line-height: 1.5; }

.ops-scan-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.ops-scan-input {
  position: relative;
  flex: 1;
}
.ops-scan-input .scan-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-500);
  display: flex;
}
.ops-scan-input input {
  padding-left: 44px;
  height: 48px;
  font-size: 1.05rem;
}
.ops-scan-row .btn { height: 48px; padding: 0 18px; white-space: nowrap; }

.scale-panel {
  background: linear-gradient(160deg, #0b1c33 0%, #132a4a 55%, #0f2744 100%);
  color: #fff;
  border-radius: 12px;
  padding: 12px 16px 10px;
  margin-bottom: 10px;
}
.scale-panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 8px;
}
.scale-panel-top #scaleModeTag { opacity: 0.65; margin-left: 4px; }
.scale-panel .stability {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 20px;
  opacity: 1;
}
.scale-panel .stability.stable { background: rgba(5, 150, 105, 0.35); color: #a7f3d0; }
.scale-panel .stability.unstable { background: rgba(217, 119, 6, 0.35); color: #fde68a; }

.scale-panel-value {
  text-align: center;
  padding: 4px 0 10px;
}
.scale-panel-value .value {
  font-family: var(--mono);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1;
}
.scale-panel-value .unit {
  font-size: 1.25rem;
  opacity: 0.7;
  margin-left: 6px;
}

.scale-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 12px;
}
.scale-metric {
  text-align: center;
}
.scale-metric .m-label {
  display: block;
  font-size: 0.72rem;
  opacity: 0.65;
  margin-bottom: 2px;
}
.scale-metric .m-value {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
}

.ops-prompt {
  border: 1.5px dashed var(--gray-300);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--gray-500);
  font-size: 0.88rem;
  text-align: center;
  margin-bottom: 14px;
  background: var(--gray-50);
}

.action-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.ops-guide {
  background: linear-gradient(180deg, #0f2744 0%, #1a3658 100%);
  color: #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  min-height: 420px;
}
.ops-guide h3 {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.ops-guide-block { margin-bottom: 14px; }
.ops-guide-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #6ee7b7;
  margin-bottom: 4px;
}
.ops-guide-block p {
  font-size: 0.8rem;
  line-height: 1.65;
  color: rgba(226, 232, 240, 0.88);
}

.recent-passes .recent-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-600);
  background: var(--primary-50);
  padding: 3px 10px;
  border-radius: 20px;
}

.weigh-workspace {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

.scan-area {
  text-align: center;
  padding: 32px 20px;
}

.scan-input-wrapper {
  position: relative;
  max-width: 480px;
  margin: 0 auto 20px;
}

.scan-input-wrapper .scan-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--primary-500);
}

.scan-input-wrapper input {
  padding-left: 48px;
  height: 52px;
  font-size: 1.2rem;
}

.weight-display {
  background: var(--primary-900);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  margin-bottom: 20px;
}

.weight-display .label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 8px;
}

.weight-display .value {
  font-family: var(--mono);
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.weight-display .unit {
  font-size: 1.2rem;
  opacity: 0.7;
  margin-left: 4px;
}

.weight-display .stability {
  margin-top: 10px;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
}

.weight-display .stability.stable { background: rgba(5, 150, 105, 0.3); }
.weight-display .stability.unstable { background: rgba(217, 119, 6, 0.3); }

.phase-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.phase-step {
  flex: 1;
  padding: 14px;
  text-align: center;
  background: var(--gray-50);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-500);
  position: relative;
}

.phase-step.active { background: var(--primary-600); color: #fff; }
.phase-step.done { background: var(--success-bg); color: var(--success); }

.phase-step .step-num {
  display: block;
  font-size: 0.72rem;
  opacity: 0.7;
  margin-bottom: 2px;
}

.current-record {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 20px;
}

.current-record dl {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 12px;
  font-size: 0.88rem;
}

.current-record dt { color: var(--gray-500); font-weight: 500; }
.current-record dd { color: var(--gray-800); font-weight: 600; font-family: var(--mono); }

/* ===== 表格 ===== */
.table-wrapper { overflow-x: auto; }

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.records-table-wrap {
  overflow-x: visible;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.data-table.records-table:not(.records-full) {
  table-layout: fixed;
  font-size: 0.84rem;
}

table.data-table.records-table:not(.records-full) th,
table.data-table.records-table:not(.records-full) td {
  padding: 8px 10px;
  vertical-align: middle;
  word-break: break-word;
}

table.data-table.records-table:not(.records-full) th:nth-child(1),
table.data-table.records-table:not(.records-full) td:nth-child(1) { width: 8%; }
table.data-table.records-table:not(.records-full) th:nth-child(2),
table.data-table.records-table:not(.records-full) td:nth-child(2) { width: 16%; }
table.data-table.records-table:not(.records-full) th:nth-child(3),
table.data-table.records-table:not(.records-full) td:nth-child(3) { width: 7%; }
table.data-table.records-table:not(.records-full) th:nth-child(4),
table.data-table.records-table:not(.records-full) td:nth-child(4),
table.data-table.records-table:not(.records-full) th:nth-child(5),
table.data-table.records-table:not(.records-full) td:nth-child(5) { width: 10%; }
table.data-table.records-table:not(.records-full) th:nth-child(6),
table.data-table.records-table:not(.records-full) td:nth-child(6) { width: 8%; }
table.data-table.records-table:not(.records-full) th:nth-child(7),
table.data-table.records-table:not(.records-full) td:nth-child(7) { width: 8%; }
table.data-table.records-table:not(.records-full) th:nth-child(8),
table.data-table.records-table:not(.records-full) td:nth-child(8) { width: 8%; }
table.data-table.records-table:not(.records-full) th:nth-child(9),
table.data-table.records-table:not(.records-full) td:nth-child(9) { width: 9%; }
table.data-table.records-table:not(.records-full) th:nth-child(10),
table.data-table.records-table:not(.records-full) td:nth-child(10) { width: 16%; }

table.data-table.records-full {
  table-layout: auto;
}
.records-table-wrap:has(.records-full) {
  overflow-x: auto;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}
.cell-stack .cell-main { font-weight: 600; }
.cell-stack .cell-sub {
  font-size: 0.72rem;
  color: var(--gray-500);
  white-space: nowrap;
}
.plate-id {
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
  line-height: 1.3;
}
.nowrap { white-space: nowrap; }
.muted-dash { color: #94a3b8; }

table.data-table th {
  background: var(--primary-800);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

table.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ship-remark {
  margin-top: 4px;
  font-size: 0.75rem;
  color: #991b1b;
  max-width: 160px;
  white-space: normal;
  line-height: 1.3;
}
.scan-context strong { color: #1e3a5f; }

.weigh-mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #f0f7ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
}
.weigh-mode-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e3a5f;
}
.weigh-mode-btn {
  min-width: 96px;
  border: 1.5px solid #93c5fd;
  background: #fff;
  color: #1d4ed8;
}
.weigh-mode-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.weigh-mode-btn[data-mode="post"].active {
  background: #059669;
  border-color: #059669;
}
.weigh-mode-hint {
  font-size: 0.8rem;
  color: #64748b;
  flex: 1;
  min-width: 200px;
}

.inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-row .form-control { flex: 1; }
.cavity-panel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-200, #e5e7eb);
}

table.data-table tr:hover td { background: var(--gray-50); }

table.data-table tr.group-row td {
  background: #eef3f8;
  font-weight: 600;
  color: #1e3a5f;
  border-bottom: 1px solid #d5e0eb;
}
.batch-group-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.batch-group-ship,
.batch-ship-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}
table.data-table tr.group-cavity td {
  background: #f6f8fb;
  font-weight: 500;
  color: #3a5068;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-pending { background: var(--gray-200); color: var(--gray-700); }
.badge-pre_done { background: var(--warning-bg); color: var(--warning); }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-corrected { background: var(--primary-50); color: var(--primary-700); }
.badge-abnormal { background: var(--danger-bg); color: var(--danger); }

/* ===== 筛选栏 ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-end;
}

.filter-bar .form-group { margin-bottom: 0; }
.filter-bar .form-control { min-width: 140px; }

.filter-bar-v2 {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.filter-fixed,
.filter-extra-row,
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}
.filter-extra-row .form-group { flex: 1; min-width: 160px; }
.filter-extra-row .filter-value { min-width: 180px; }
.filter-actions { margin-top: 2px; }

/* ===== 审计日志分组 ===== */
.audit-grouped, .audit-feed { display: flex; flex-direction: column; gap: 10px; }
.audit-user {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.04);
}
.audit-user > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  font-weight: 600;
  color: #1e3a5f;
  user-select: none;
}
.audit-user > summary::-webkit-details-marker { display: none; }
.audit-user > summary:hover { background: #eef4fb; }
.audit-user-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.audit-user-avatar {
  --av-from: #60a5fa;
  --av-to: #1d4ed8;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--av-from), var(--av-to));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
  box-shadow:
    0 0 0 2px rgba(37, 99, 235, 0.12),
    0 4px 12px rgba(37, 99, 235, 0.22);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
.audit-user-avatar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.4), transparent 55%);
  pointer-events: none;
}
.audit-user-name {
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-user-meta {
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}
.audit-user-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  margin-right: 4px;
}
.audit-user[open] > summary .audit-user-chevron {
  transform: rotate(45deg);
  margin-top: -4px;
}
.audit-user-body {
  padding: 10px 12px 12px;
  background: #fafbfc;
  border-top: 1px solid #e8eef5;
  gap: 8px;
}
.audit-sub { padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.audit-cat {
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fafbfc;
}
.audit-cat > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
}
.audit-cat > summary::-webkit-details-marker { display: none; }
.audit-cat .table-wrapper { margin: 0 8px 8px; }
.audit-empty, .audit-footer, .muted {
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
  padding: 16px 8px;
}
.audit-footer { text-align: left; padding-top: 4px; }

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.pagination-btns { display: flex; gap: 6px; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 39, 68, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 1.05rem; color: var(--primary-800); }

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--gray-400);
  line-height: 1;
}

.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== 系统信息 ===== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.info-item {
  padding: 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary-500);
}

.info-item .info-label { font-size: 0.78rem; color: var(--gray-500); margin-bottom: 4px; }
.info-item .info-value { font-size: 0.92rem; font-weight: 600; color: var(--gray-800); }

.hidden { display: none !important; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .weigh-workspace { grid-template-columns: 1fr; }
  .weigh-grid { grid-template-columns: 1fr; }
  .weigh-main-grid { grid-template-columns: 1fr; }
  .ops-guide, .tip-panel { min-height: auto; position: static; }
  .procbar { grid-template-columns: repeat(3, 1fr); }
  .scale-metrics { grid-template-columns: repeat(2, 1fr); }
  .station-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .login-page { padding: 28px 16px; }
  .login-shell-min { padding: 22px 18px; }
  .login-title-min { margin-bottom: 18px; color: #16365d; }
  .login-title-company { font-size: 0.95rem; }
  .login-title-system { font-size: 1.08rem; letter-spacing: 0.08em; }

  .btn-icon.menu-toggle { display: inline-flex; }
  .sidebar-collapse-btn { display: none; }

  .sidebar {
    transform: translateX(-100%);
    width: min(86vw, 300px);
    transition: transform 0.22s ease;
  }
  .app-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .app-layout.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 22, 40, 0.45);
    z-index: 90;
  }
  /* 移动端不使用桌面收起宽度 */
  .app-layout.sidebar-collapsed {
    --sidebar-w: 268px;
  }
  .app-layout.sidebar-collapsed .sidebar-brand h1,
  .app-layout.sidebar-collapsed .sidebar-sub,
  .app-layout.sidebar-collapsed .nav-item {
    font-size: inherit;
  }
  .app-layout.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    padding: 12px 14px;
    gap: 12px;
  }
  .app-layout.sidebar-collapsed .user-info > div:last-child,
  .app-layout.sidebar-collapsed .logout-btn {
    display: revert;
  }

  .main-content { margin-left: 0; }
  .top-bar {
    flex-wrap: wrap;
    gap: 10px;
    height: auto;
    min-height: var(--header-h);
    padding: 10px 12px;
  }
  .top-bar-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .top-bar-actions .form-control {
    min-width: 0 !important;
    flex: 1;
  }
  .ops-terminal-badge { display: none; }
  .page-body { padding: 12px; }
  .stats-grid { grid-template-columns: 1fr; }
  .procbar { grid-template-columns: repeat(2, 1fr); }
  .scan-box { flex-wrap: wrap; }
  .unpack-layout { grid-template-columns: 1fr; }
  .filter-bar, .filter-bar-v2, .audit-filter-bar, .scale-connect-bar {
    flex-direction: column;
    align-items: stretch !important;
  }
  .filter-fixed, .filter-extra { width: 100%; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .audit-user > summary {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .audit-user-meta {
    grid-column: 1 / -1;
    white-space: normal;
  }
  .audit-user-chevron { display: none; }
  .audit-card {
    grid-template-columns: auto 1fr;
  }
  .audit-card-meta {
    grid-column: 1 / -1;
    text-align: left;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }
  .audit-card-meta .who { display: inline; margin: 0; }
  .weigh-dock-inner { flex-wrap: wrap; }
  .row-actions .btn { min-height: 36px; }
  .modal { width: calc(100vw - 24px); max-width: 480px; }

  /* ---- 表格：手机端可横滑，避免挤爆 ---- */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .table-wrapper > table.data-table {
    min-width: 560px;
  }

  /* 数据明细紧凑列：改为卡片，不再挤十列 */
  .records-table-wrap {
    overflow-x: visible;
  }
  #page-records table.data-table.records-table:not(.records-full) {
    table-layout: auto;
    width: 100%;
    min-width: 0;
    font-size: 0.84rem;
  }
  #page-records table.data-table.records-table:not(.records-full) thead {
    display: none;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody tr:not(.group-row) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: #fff;
    border: 1px solid #e7ebf1;
    border-radius: 12px;
    padding: 2px 0 0;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    overflow: hidden;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody tr:not(.group-row) td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    width: auto !important;
    min-width: 0;
    padding: 9px 12px;
    border-bottom: 1px solid #f1f4f8;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.35;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody tr:not(.group-row) td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #96a0ae;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody tr:not(.group-row) td .nowrap,
  #page-records table.data-table.records-table:not(.records-full) tbody tr:not(.group-row) td .plate-id {
    white-space: normal;
    word-break: break-all;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody tr:not(.group-row) td[data-label="操作"] {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    border-bottom: none;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody tr:not(.group-row) td[data-label="操作"]::before {
    display: none;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody tr.group-row {
    display: block;
    background: #f5f7fa;
    border: 1px solid #e7ebf1;
    border-radius: 10px;
    padding: 0;
  }
  #page-records table.data-table.records-table:not(.records-full) tbody tr.group-row td {
    display: block;
    width: 100% !important;
    border: none;
    padding: 10px 12px;
    white-space: normal;
    word-break: break-word;
  }

  /* 完整列：横向滑动，并提示可滑动 */
  #page-records table.data-table.records-full {
    min-width: 1180px;
  }
  .records-table-wrap:has(.records-full) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .records-table-wrap[data-mode="full"]::after {
    content: "完整列较宽，可左右滑动查看";
    display: block;
    margin-top: 8px;
    font-size: 0.72rem;
    color: #96a0ae;
    letter-spacing: 0.02em;
  }

  /* 顶栏筛选在手机上更紧凑 */
  .top-bar-actions #workshopSelect,
  .top-bar-actions #stationSelect {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
  }
  .card-header-actions {
    width: 100%;
  }
  .card-header-actions .btn {
    flex: 1;
  }
  .pagination {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ===== 数据门户 ===== */
.ops-terminal-badge.portal-badge {
  background: #059669;
}

.portal-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, #0f766e, #059669);
  color: #fff;
  font-size: 0.88rem;
}

/* 范围条 */
.portal-scopebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 11px 16px;
  border-radius: 12px;
  background: linear-gradient(100deg, #ffffff 0%, #f6f9fd 100%);
  border: 1px solid #e8eef6;
  box-shadow: 0 4px 16px rgba(15, 39, 68, 0.04);
}
.portal-scopebar .scope-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.portal-scopebar .scope-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.12);
  flex: none;
}
.portal-scopebar .scope-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-800);
  letter-spacing: 0.01em;
}
.portal-scopebar .scope-chip {
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  color: var(--primary-700);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}
.portal-scopebar .scope-right {
  font-size: 0.76rem;
  color: var(--gray-400);
  font-variant-numeric: tabular-nums;
}

/* KPI */
.portal-dash .portal-stats {
  margin-bottom: 18px;
}
.portal-dash .portal-stats .stat-card {
  background: linear-gradient(165deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 6px 20px rgba(15, 39, 68, 0.05);
  border: 1px solid #e8eef6;
  padding: 18px 18px 16px 58px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.portal-dash .portal-stats .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(15, 39, 68, 0.09);
}
.portal-dash .portal-stats .stat-ico {
  top: 20px;
  transform: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
}
.portal-dash .portal-stats .stat-label {
  font-size: 0.79rem;
  letter-spacing: 0.02em;
}
.portal-dash .portal-stats .stat-value {
  font-size: 1.95rem;
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--primary-900);
}

.portal-stats .stat-sub {
  margin-top: 5px;
  font-size: 0.74rem;
  color: var(--gray-500);
}

/* 自适应栅格：隐藏卡片时同排卡片自动补位 */
.portal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: stretch;
}
.portal-cell {
  min-width: 0;
  display: flex;
}
.portal-cell > .card {
  width: 100%;
  display: flex;
  flex-direction: column;
}
.portal-cell > .card > .card-body {
  flex: 1;
}
.cell-12 { flex: 1 1 100%; }
.cell-7 { flex: 1 1 calc(58.334% - 8px); }
.cell-6 { flex: 1 1 calc(50% - 8px); }
.cell-5 { flex: 1 1 calc(41.666% - 8px); }

/* 兼容旧结构 */
.portal-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.portal-panels-full {
  grid-template-columns: 1fr;
}

.portal-dash .portal-card {
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
  border: 1px solid #e8eef6;
  box-shadow: 0 8px 24px rgba(15, 39, 68, 0.05);
  overflow: hidden;
}
.portal-dash .portal-card .card-header {
  padding: 14px 20px;
  border-bottom: 1px solid #eef2f7;
  background: linear-gradient(180deg, #f9fbfe 0%, #ffffff 100%);
}
.portal-dash .portal-card .card-header h3 {
  font-weight: 700;
  letter-spacing: 0.01em;
  position: relative;
  padding-left: 11px;
}
.portal-dash .portal-card .card-header h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary-500), var(--primary-700));
}
.portal-dash .portal-card .recent-tag {
  color: var(--gray-400);
  font-size: 0.74rem;
}
.portal-dash .portal-card-hero .card-body {
  padding: 16px 20px 18px;
}

/* 收料推移摘要 */
.combo-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #e6edf6;
}
.combo-summary .cs-item {
  min-width: 0;
}
.combo-summary .cs-lab {
  display: block;
  font-size: 0.73rem;
  color: var(--gray-500);
  margin-bottom: 3px;
}
.combo-summary .cs-val {
  display: block;
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--primary-900);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.combo-summary .cs-val small {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
  margin-left: 2px;
}
.combo-summary .cs-item.accent .cs-val { color: #b45309; }

/* 同排卡片高度对齐时的内容居中 */
.portal-dash .portal-card .hbar-chart {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.portal-dash .portal-card .hbar-list {
  flex: 1;
  justify-content: center;
}

/* 状态分布甜甜圈 */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  height: 100%;
}
.donut-fig {
  position: relative;
  width: 168px;
  height: 168px;
  flex: none;
}
.donut-fig svg {
  width: 100%;
  height: 100%;
  display: block;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-center .dc-val {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--primary-900);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.donut-center .dc-lab {
  font-size: 0.72rem;
  color: var(--gray-500);
  margin-top: 2px;
}
.donut-legend {
  flex: 1 1 160px;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.donut-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 2px;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.78rem;
  color: var(--gray-500);
}
.donut-total strong {
  font-size: 1.3rem;
  color: var(--primary-800);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.donut-legend .dl-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.donut-legend .dl-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.donut-legend .dl-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.donut-legend .dl-lab {
  font-size: 0.82rem;
  color: var(--gray-600);
}
.donut-legend .dl-num {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-900);
  font-variant-numeric: tabular-nums;
}
.donut-legend .dl-pct {
  font-size: 0.73rem;
  color: var(--gray-400);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}
.trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.trend-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}
.trend-legend .leg-bar i {
  width: 12px;
  height: 10px;
  border-radius: 3px;
}
.trend-legend .leg-line i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  box-shadow: none;
}

.portal-dist {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: center;
}
.portal-dist .dist-tile {
  padding: 14px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e8eef6;
}
.portal-dist .dist-num {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--primary-800);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.portal-dist .dist-tile.ok .dist-num { color: var(--success); }
.portal-dist .dist-tile.warn .dist-num { color: var(--warning); }
.portal-dist .dist-tile.bad .dist-num { color: var(--danger); }
.portal-dist .dist-lab {
  display: block;
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--gray-500);
  font-weight: 500;
}

.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 140px;
  padding-top: 8px;
}
.mini-bar-item {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.mini-bar-track {
  height: 90px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--gray-50);
  border-radius: 8px 8px 0 0;
}
.mini-bar-fill {
  width: 60%;
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}
.mini-bar-val {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
  color: var(--gray-700);
}
.mini-bar-lab {
  font-size: 0.7rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hbar-chart { width: 100%; }
.hbar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 0.82rem;
  color: var(--gray-500);
}
.hbar-head strong {
  font-size: 1.35rem;
  color: var(--primary-800);
  font-variant-numeric: tabular-nums;
}
.hbar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hbar-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
}
.hbar-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
}
.hbar-track {
  height: 14px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 6px;
  transition: width 0.35s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.hbar-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-800);
  text-align: right;
  min-width: 72px;
  font-variant-numeric: tabular-nums;
}
.hbar-share {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-400);
}

@media (max-width: 768px) {
  .hbar-row {
    grid-template-columns: 52px 1fr auto;
    gap: 8px;
  }
  .hbar-val { min-width: 58px; font-size: 0.84rem; }
}

.trend-chart {
  width: 100%;
}
.trend-chart svg {
  width: 100%;
  height: 180px;
  display: block;
}
.combo-chart svg {
  height: 280px;
}
.combo-bar {
  transition: opacity 0.15s ease;
}
.combo-chart:hover .combo-bar {
  opacity: 0.88;
}
.combo-chart .combo-bar:hover {
  opacity: 1;
}
.trend-chart-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  font-size: 0.74rem;
  color: var(--gray-500);
}
.trend-chart-empty {
  padding: 48px 12px;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.88rem;
  background: linear-gradient(180deg, #f8fafc, #fff);
  border-radius: 12px;
  border: 1px dashed #e2e8f0;
}

/* 标签筛选 */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.tag-chip {
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}
.tag-chip:hover { border-color: #93c5fd; color: #1d4ed8; }
.tag-chip.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
  font-weight: 600;
}

.system-hint {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 14px;
  line-height: 1.6;
}

/* 审计信息流 */
.audit-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.audit-card {
  border: 1px solid #e8eef5;
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 14px;
  align-items: start;
}
.audit-card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  white-space: nowrap;
}
.audit-card-tag.login { background: #ecfdf5; color: #047857; }
.audit-card-tag.weigh { background: #eff6ff; color: #1d4ed8; }
.audit-card-tag.ship { background: #f0fdf4; color: #15803d; }
.audit-card-tag.correct { background: #fff7ed; color: #c2410c; }
.audit-card-tag.account { background: #f5f3ff; color: #6d28d9; }
.audit-card-tag.other { background: #f1f5f9; color: #475569; }
.audit-card-main { min-width: 0; }
.audit-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary-800);
  margin-bottom: 2px;
}
.audit-card-detail {
  font-size: 0.84rem;
  color: var(--gray-600);
  line-height: 1.45;
  word-break: break-word;
}
.audit-card-meta {
  font-size: 0.75rem;
  color: var(--gray-400);
  text-align: right;
  white-space: nowrap;
}
.audit-card-meta .who { display: block; color: var(--gray-600); font-weight: 500; margin-bottom: 2px; }

.client-vis-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.client-vis-group-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-800);
  margin-bottom: 8px;
}
.client-vis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 12px;
}
.client-vis-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.84rem;
  color: var(--gray-700);
  cursor: pointer;
  user-select: none;
}
.client-vis-item:hover { border-color: #93c5fd; background: #eff6ff; }
.client-vis-item input { width: 16px; height: 16px; accent-color: #1d4ed8; }

.plate-board {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #dbe3ef;
}
.plate-board.empty {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--gray-500);
  text-align: center;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
}
.plate-board-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.plate-board-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.plate-chip {
  border: 1px solid #dbe3ef;
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 72px;
  font-family: var(--font);
  transition: all 0.15s;
}
.plate-chip b { font-size: 0.95rem; color: var(--primary-800); }
.plate-chip small { font-size: 0.72rem; color: var(--gray-500); }
.plate-chip:hover { border-color: #93c5fd; background: #eff6ff; }
.plate-chip.active {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
.plate-chip.st-pre_done small { color: #d97706; font-weight: 600; }
.plate-chip.st-completed small,
.plate-chip.st-corrected small { color: #059669; font-weight: 600; }
.plate-chip.st-abnormal small { color: #dc2626; font-weight: 600; }
.plate-chip.st-pending small { color: #64748b; }

#receiptBatchBody tr.row-active td {
  background: #eff6ff;
}
#receiptBatchBody tr[data-batch] { cursor: default; }

.collect-bottle-float {
  position: fixed;
  right: 20px;
  bottom: 100px;
  z-index: 40;
  width: min(320px, calc(100vw - 40px));
  max-height: min(420px, calc(100vh - 140px));
  overflow: auto;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  padding: 12px 14px;
}
.collect-bottle-float.hidden { display: none !important; }
.cbf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--primary-800);
}
.cbf-progress {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 600;
}
.cbf-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cbf-empty {
  font-size: 0.82rem;
  color: var(--gray-500);
  text-align: center;
  padding: 16px 8px;
  background: #f8fafc;
  border-radius: 8px;
}
.cbf-chip {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cbf-chip:hover { border-color: #93c5fd; background: #f8fbff; }
.cbf-chip.active {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.cbf-chip b { font-size: 0.95rem; color: var(--primary-800); }
.cbf-chip small { font-size: 0.75rem; color: var(--gray-500); font-weight: 600; }
.cbf-chip.st-pre_done small { color: #d97706; }
.cbf-chip.st-completed small { color: #059669; }
.cbf-meta {
  font-size: 0.72rem;
  color: var(--gray-500);
}
.cbf-foot {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
  font-size: 0.78rem;
  color: #b45309;
  font-weight: 600;
}
.cbf-foot.ok { color: #059669; }

.audit-empty, .audit-footer {
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
  padding: 16px 8px;
}
.audit-footer { text-align: left; padding-top: 4px; }

@media (max-width: 1024px) {
  .portal-panels { grid-template-columns: 1fr; }
  .portal-dist { grid-template-columns: repeat(2, 1fr); }
  .portal-cell { flex: 1 1 100%; }
  .combo-summary { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }
}

@media (max-width: 768px) {
  .portal-scopebar { align-items: flex-start; }
  .portal-scopebar .scope-left { flex-wrap: wrap; }
  .donut-wrap { justify-content: center; }
  .donut-legend { flex-basis: 100%; }
}

/* ==================================================================
   精致化与交互增强
   ================================================================== */

/* ---- 排版：数字统一等宽、标题字距收紧 ---- */
.stat-value,
.dist-num,
.hbar-val,
.dl-num,
.cs-val,
.mono,
td.mono,
.donut-total strong {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

h1, h2, h3 { letter-spacing: -0.01em; }

/* ---- 滚动条 ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
  background-clip: padding-box;
}

/* ---- 图标：统一描边渲染 ---- */
.nav-ico svg,
.stat-ico svg,
.btn-ico svg,
.btn-icon svg,
.sidebar-collapse-btn svg {
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
}

/* 侧栏图标改用 currentColor，随状态变色 */
.nav-ico {
  color: #a5c9f7;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease;
}
.nav-ico svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  filter: none;
}
.nav-item:hover .nav-ico {
  color: #dbeafe;
  transform: translateY(-1px);
}
.nav-item.active .nav-ico {
  color: #fff;
}

/* 统计卡图标：描边细化 + 悬停微放大 */
.stat-ico svg {
  stroke-width: 1.7;
}
.stat-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-ico {
  transition: transform 0.18s ease, background 0.18s ease;
}
/* 默认卡片的图标是 top:50% + translateY(-50%) 定位，缩放时需保留位移 */
.stat-card:hover .stat-ico {
  transform: translateY(-50%) scale(1.06);
}
/* 数据总览的图标改为顶部定位、无位移 */
.portal-dash .portal-stats .stat-card:hover .stat-ico {
  transform: scale(1.06);
}

/* ---- 焦点可见性 ---- */
.btn:focus-visible,
.tag-chip:focus-visible,
.nav-item:focus-visible,
.btn-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.28);
}

/* ---- 按钮：悬浮抬升 + 按下回弹 ---- */
.btn {
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.12s ease, box-shadow 0.18s ease;
}
.btn-primary,
.btn-success,
.btn-danger {
  box-shadow: 0 2px 6px rgba(15, 39, 68, 0.12);
}
.btn-primary:hover,
.btn-success:hover,
.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 39, 68, 0.18);
}
.btn-outline:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 39, 68, 0.08);
  background: #fbfdff;
}
.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
  box-shadow: 0 1px 3px rgba(15, 39, 68, 0.14);
}
.btn:disabled { box-shadow: none; transform: none; }

/* ---- 卡片：轻微抬升 ---- */
.card {
  transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
}
.portal-dash .portal-card:hover {
  box-shadow: 0 16px 36px rgba(15, 39, 68, 0.09);
  border-color: #dbe6f4;
}

/* ---- 表格：斑马纹 + 悬停高亮 ---- */
table.data-table th {
  background: linear-gradient(180deg, #26456f 0%, var(--primary-800) 100%);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  position: relative;
}
table.data-table th:first-child { border-top-left-radius: 8px; }
table.data-table th:last-child { border-top-right-radius: 8px; }
table.data-table tbody tr {
  transition: background 0.15s ease;
}
/* 斑马纹放在 tr 上，分组行自身的 td 背景仍可覆盖 */
table.data-table tbody tr:nth-child(even) { background: #fbfcfe; }
table.data-table tbody tr:not(.group-row):not(.group-cavity):not(.row-active):hover > td {
  background: var(--primary-50);
}
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ---- 侧栏导航：滑入指示条 ---- */
.nav-item {
  position: relative;
  transition: background 0.18s ease, color 0.18s ease, transform 0.14s ease;
}
.nav-item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 0 3px 3px 0;
  background: #fff;
  transform: translateY(-50%);
  transition: height 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-item.active::after { height: 60%; }
.nav-item:not(.active):hover { transform: translateX(2px); }

/* ---- 标签筛选 ---- */
.tag-chip {
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease,
    transform 0.12s ease, box-shadow 0.16s ease;
}
.tag-chip:hover { transform: translateY(-1px); }
.tag-chip.active { box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18); }

/* ---- Toast：图标 + 进出场 ---- */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 39, 68, 0.22);
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.out {
  animation: toastOut 0.22s ease forwards;
}
.toast-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}
.toast-msg { min-width: 0; }
@keyframes toastIn {
  from { transform: translateX(28px) scale(0.96); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes toastOut {
  to { transform: translateX(28px) scale(0.96); opacity: 0; }
}

/* ---- 骨架屏 ---- */
.skeleton-chart {
  width: 100%;
  border-radius: 12px;
  background: linear-gradient(100deg, #f1f5f9 30%, #e6edf6 50%, #f1f5f9 70%);
  background-size: 220% 100%;
  animation: skeletonSweep 1.2s ease-in-out infinite;
}
@keyframes skeletonSweep {
  from { background-position: 140% 0; }
  to { background-position: -40% 0; }
}

/* ---- 图表交互：悬浮提示 ---- */
.chart-tip {
  position: fixed;
  z-index: 9998;
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.5;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.chart-tip.show { opacity: 1; transform: translateY(0); }
.chart-tip .ct-title {
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  letter-spacing: 0.02em;
}
.chart-tip .ct-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
}
.chart-tip .ct-row i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
}
.chart-tip .ct-lab { color: rgba(255, 255, 255, 0.72); }
.chart-tip .ct-val {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chart-hit { cursor: crosshair; }
.chart-hit.on { fill: rgba(37, 99, 235, 0.05); }
.chart-guide {
  opacity: 0;
  transition: opacity 0.14s ease;
  pointer-events: none;
}

/* ---- 图表入场动画 ---- */
.combo-bar {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: barRise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes barRise {
  from { transform: scaleY(0.02); opacity: 0.35; }
  to { transform: scaleY(1); opacity: 1; }
}
.chart-line-draw {
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: lineDraw 1.1s cubic-bezier(0.33, 1, 0.68, 1) 0.15s forwards;
}
@keyframes lineDraw {
  to { stroke-dashoffset: 0; }
}
.chart-fade-in {
  animation: chartFade 0.5s ease both;
}
@keyframes chartFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.chart-dot {
  transition: r 0.14s ease, stroke-width 0.14s ease;
}
.chart-dot:hover { r: 5.5; }

.donut-fig svg { animation: donutPop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes donutPop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* 图例可点击切换 */
.trend-legend span[data-series] {
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  user-select: none;
}
.trend-legend span[data-series]:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.trend-legend span[data-series].off {
  opacity: 0.4;
  text-decoration: line-through;
}

/* 横向条：悬停提亮 */
.hbar-row {
  transition: transform 0.14s ease;
}
.hbar-row:hover { transform: translateX(2px); }
.hbar-fill {
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1), filter 0.16s ease;
}
.hbar-row:hover .hbar-fill { filter: brightness(1.08); }

/* 甜甜圈图例悬停 */
.donut-legend .dl-row {
  border-radius: 6px;
  transition: background 0.15s ease;
}
.donut-legend .dl-row:hover { background: #f8fafc; }

/* KPI 数字跳动时不换行抖动 */
.portal-dash .portal-stats .stat-value { min-height: 2.3rem; }

/* 页面切换淡入：只用透明度，避免 transform 影响页内 fixed 浮窗 */
.page:not(.hidden) {
  animation: pageIn 0.26s ease;
}
@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- 降低动效偏好 ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================================================================
   质感重构：克制的中性底色、标签化标题、收敛的装饰
   ================================================================== */

/* 去掉带蓝的背景光晕，换成中性纸面 */
.main-content {
  background: #f6f7f9;
}

/* 卡片：发丝描边 + 近乎无感的投影，取代大面积渐变与重阴影 */
.portal-dash .portal-card,
.portal-dash .portal-stats .stat-card,
.portal-scopebar {
  background: #fff;
  border: 1px solid #e7ebf1;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.portal-dash .portal-card:hover {
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.07);
  border-color: #dde3ec;
}

/* 卡片标题改为「字段标签」风格：小字号、加字距、去掉彩色竖条 */
.portal-dash .portal-card .card-header {
  background: transparent;
  border-bottom: 1px solid #eef1f5;
  padding: 15px 20px 13px;
}
.portal-dash .portal-card .card-header h3 {
  padding-left: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #64748b;
}
.portal-dash .portal-card .card-header h3::before {
  display: none;
}
.portal-dash .portal-card .recent-tag {
  font-size: 0.72rem;
  color: #a6b0be;
  letter-spacing: 0.02em;
}

/* KPI：去掉左侧色条，图标移到右上并弱化，数字放大压紧 */
.portal-dash .portal-stats .stat-card {
  padding: 16px 18px 15px;
  background: #fff;
}
.portal-dash .portal-stats .stat-card::before {
  display: none;
}
.portal-dash .portal-stats .stat-ico {
  left: auto;
  right: 14px;
  top: 14px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: transparent;
  opacity: 0.5;
}
.portal-dash .portal-stats .stat-ico svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.6;
}
.portal-dash .portal-stats .stat-card:hover .stat-ico { opacity: 0.85; }
.portal-dash .portal-stats .stat-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: #8d97a5;
}
.portal-dash .portal-stats .stat-value {
  margin-top: 8px;
  font-size: 2.05rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: #16202f;
}
.portal-dash .portal-stats .stat-sub {
  margin-top: 4px;
  font-size: 0.73rem;
  color: #9aa4b2;
}
.portal-dash .portal-stats .stat-card:hover {
  transform: none;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.07);
  border-color: #dde3ec;
}

/* 范围条 */
.portal-scopebar {
  padding: 10px 16px;
  border-radius: 10px;
}
.portal-scopebar .scope-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #5a677a;
}
.portal-scopebar .scope-chip {
  background: #f2f5f9;
  border-color: #e3e9f1;
  color: #4b5a70;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.portal-scopebar .scope-dot {
  background: #2f6f62;
  box-shadow: 0 0 0 3px rgba(47, 111, 98, 0.12);
}
.portal-scopebar .scope-right { color: #a6b0be; }

/* 主图摘要：标签更轻、数字更沉 */
.combo-summary {
  border-bottom: 1px solid #eef1f5;
  padding-bottom: 15px;
  margin-bottom: 18px;
}
.combo-summary .cs-lab {
  font-size: 0.71rem;
  letter-spacing: 0.07em;
  color: #96a0ae;
  font-weight: 600;
}
.combo-summary .cs-val {
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #16202f;
}
.combo-summary .cs-val small {
  font-size: 0.68rem;
  color: #a6b0be;
  margin-left: 3px;
  letter-spacing: 0;
}
.combo-summary .cs-item.accent .cs-val { color: #99691f; }

/* 图例 */
.trend-legend {
  gap: 6px;
  font-size: 0.76rem;
  color: #6b7788;
  margin-bottom: 14px;
}
.trend-legend i {
  box-shadow: none;
}
.trend-legend .leg-bar i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}
.trend-legend .leg-line i {
  width: 13px;
  height: 2px;
}

/* 图表脚注 */
.trend-chart-meta {
  border-top: 1px solid #f1f4f8;
  font-size: 0.71rem;
  color: #a6b0be;
  letter-spacing: 0.02em;
}

/* 环形图：细环 + 沉稳中心数字 */
.donut-fig { width: 176px; height: 176px; }
.donut-center .dc-val {
  font-size: 1.68rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #16202f;
}
.donut-center .dc-lab {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: #9aa4b2;
  margin-top: 3px;
}
.donut-total {
  border-bottom: 1px solid #eef1f5;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  color: #96a0ae;
  font-weight: 600;
}
.donut-total strong {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #16202f;
}
.donut-legend .dl-row { border-bottom-color: #f2f5f9; }
.donut-legend .dl-dot { width: 8px; height: 8px; border-radius: 2px; }
.donut-legend .dl-lab { font-size: 0.79rem; color: #6b7788; }
.donut-legend .dl-num {
  font-size: 0.92rem;
  font-weight: 600;
  color: #16202f;
}
.donut-legend .dl-pct { font-size: 0.71rem; color: #a6b0be; }

/* 车间条：细轨、低饱和 */
.hbar-head {
  border-bottom: 1px solid #eef1f5;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  color: #96a0ae;
  font-weight: 600;
}
.hbar-head strong {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #16202f;
}
.hbar-track {
  height: 9px;
  background: #f0f3f7;
}
.hbar-fill { box-shadow: none; }
.hbar-label { font-size: 0.8rem; color: #6b7788; font-weight: 500; }
.hbar-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: #16202f;
}
.hbar-share { color: #b6bfcc; font-weight: 500; }

/* 空状态 */
.trend-chart-empty {
  background: #fafbfc;
  border: 1px dashed #e7ebf1;
  color: #a6b0be;
}

/* 悬浮提示：深墨底 */
.chart-tip {
  background: #1b2433;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}
.chart-tip .ct-title {
  letter-spacing: 0.06em;
  font-size: 0.74rem;
  color: #cfd6e0;
}
.chart-tip .ct-lab { color: #97a2b2; }
