/**
 * 711退件管理系统 — Web Admin Panel
 * UI Designer: Complete visual overhaul
 * Design System: 8-pt grid | Inter/PingFang | Semantic Color Tokens
 */

/* ════════════════ Design Tokens ════════════════ */
:root {
  /* Brand — D·科技蓝立体 (Tech Blue Solid-3D) */
  --brand: #1E3A8A;
  --brand-600: #2563EB;
  --brand-500: #3B82F6;
  --brand-400: #60A5FA;
  --brand-100: #EFF4FF;
  --brand-50: #F4F7FF;

  /* Semantic */
  --green: #10B981;
  --green-light: #E7F8F0;
  --amber: #F59E0B;
  --amber-light: #FEF3E0;
  --red: #EF4444;
  --red-light: #FDECEC;

  /* Neutral */
  --gray-900: #111827;
  --gray-800: #1F2937;
  --gray-700: #374151;
  --gray-600: #5F6368;
  --gray-500: #9AA0A6;
  --gray-400: #C4C7CC;
  --gray-200: #E8EAED;
  --gray-100: #F3F4F6;
  --gray-50: #F8F9FA;

  /* Surfaces */
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --bg-page: #F0F2F5;
  --bg-sidebar: #111827;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-xl: 0 12px 40px rgba(0,0,0,0.12);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Consolas', monospace;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms;
  --dur-normal: 250ms;
  --dur-slow: 400ms;
}

/* ════════════════ Reset & Base ════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--bg-page);
  min-height: 100vh;
}

/* ════════════════ Layout ════════════════ */
.app-container { display: flex; min-height: 100vh; }

/* ════════════════ Sidebar ════════════════ */
.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #0B1426 0%, #0F1E3D 100%);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  z-index: 10;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header {
  padding: 24px 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .logo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}

.sidebar-header .logo-icon {
  width: 52px; height: 52px;
  background: transparent;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex: 0 0 52px;
}

.sidebar-header .brand-logo-image {
  width: 142%; height: 142%;
  max-width: none;
  object-fit: cover;
  display: block;
  flex: none;
}

.sidebar-header .logo-text {
  min-width: 0;
  font-size: 0.8125rem; font-weight: 800; color: #FFF;
  line-height: 1.35;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.sidebar-header .version-badge {
  display: inline-block; padding: 2px 8px;
  font-size: 0.625rem; font-weight: 700;
  color: var(--brand-400); background: rgba(37,99,235,0.15);
  border-radius: var(--radius-full); margin-top: 4px;
  letter-spacing: 0.04em; text-transform: uppercase;
}

/* Nav */
.nav-section {
  padding: 8px 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}

.nav-region {
  padding: 0 12px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nav-region:last-child { border-bottom: 0; }

.nav-group-label {
  font-size: 0.625rem; font-weight: 700; color: rgba(255,255,255,0.3);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 0 6px;
}

.nav-region-empty {
  padding: 4px 12px 8px 32px;
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.28);
}

.nav-tab {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 0.8125rem; font-weight: 500;
  color: rgba(255,255,255,0.55);
  transition: all var(--dur-fast) var(--ease);
  position: relative;
}

.nav-tab:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}

.nav-tab.active {
  background: rgba(37,99,235,0.18);
  color: #FFF;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.25);
}

.nav-tab.active::before {
  content: '';
  position: absolute; left: -13px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--brand-500);
  border-radius: 0 2px 2px 0;
}

.nav-tab .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; opacity: 0.85; flex-shrink: 0; }
.nav-tab.active .nav-icon { opacity: 1; }

.nav-tab .nav-badge {
  margin-left: auto; padding: 1px 8px;
  font-size: 0.625rem; font-weight: 700;
  background: var(--red); color: #FFF;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.6875rem; color: rgba(255,255,255,0.25);
  display: flex; align-items: center; gap: 8px;
}

.sidebar-footer .status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px rgba(13,144,79,0.5);
}
.conn-debug {
  padding: 4px 24px 12px;
  font-size: 0.625rem;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conn-debug:hover { color: rgba(255,255,255,0.6); }

/* ════════════════ Main Area ════════════════ */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: visible; }

/* ════════════════ Top Bar ════════════════ */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 28px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
}

.topbar-left {
  display: flex; gap: 10px; align-items: center;
}

.topbar .page-title {
  font-size: 0.9375rem; font-weight: 700; color: var(--gray-800);
  margin-right: 16px; white-space: nowrap;
}

.search-box {
  position: relative; width: 280px;
}

.search-box .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 0.875rem; color: var(--gray-500); pointer-events: none;
}

.search-box input {
  width: 100%; height: 38px; padding: 0 12px 0 34px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-full);
  font-size: 0.8125rem; color: var(--gray-800); background: var(--gray-50);
  outline: none; transition: all var(--dur-fast) var(--ease);
}

.search-box input::placeholder { color: var(--gray-500); }

.search-box input:focus {
  border-color: var(--brand-500); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.filter-select {
  height: 38px; padding: 0 32px 0 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-full);
  font-size: 0.8125rem; color: var(--gray-700); background: var(--gray-50);
  outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239AA0A6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: all var(--dur-fast) var(--ease);
}

.filter-select:focus {
  border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.topbar-right { display: flex; gap: 8px; align-items: center; }

/* ════════════════ Buttons ════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; height: 38px; padding: 0 18px;
  border-radius: var(--radius-full); font-size: 0.8125rem; font-weight: 600;
  border: none; cursor: pointer; transition: all var(--dur-fast) var(--ease);
  white-space: nowrap; text-decoration: none;
  position: relative; overflow: hidden;
}

.btn::after {
  content: ''; position: absolute; inset: 0;
  background: transparent; transition: background var(--dur-fast);
  border-radius: inherit;
}

.btn:active::after { background: rgba(0,0,0,0.08); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--brand-600); color: #FFF;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.btn-primary:hover { background: var(--brand); box-shadow: 0 4px 14px rgba(37,99,235,0.35); transform: translateY(-1px); }

.btn-outline {
  background: transparent; color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn-outline:hover { border-color: var(--brand-400); color: var(--brand-600); background: var(--brand-50); }

.btn-ghost {
  background: transparent; color: var(--gray-600);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }

.btn-danger {
  background: var(--red); color: #FFF;
  box-shadow: 0 2px 8px rgba(198,40,40,0.2);
}
.btn-danger:hover { background: #B71C1C; }

.btn-sm { height: 30px; padding: 0 14px; font-size: 0.75rem; border-radius: var(--radius-full); }
.btn-icon { width: 38px; padding: 0; }

/* ════════════════ Content ════════════════ */
.content { flex: 1; padding: 24px 28px 40px; overflow-y: auto; overflow-x: visible; min-height: 0; }
.tab-page { display: none; animation: fadeIn var(--dur-normal) var(--ease); }
.tab-page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ════════════════ Stats Cards ════════════════ */
.stats-row {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 16px; margin-bottom: 24px;
}

.stat-card {
  --stat-accent: var(--brand-600);
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 8cqi, 26px) clamp(12px, 6cqi, 20px) 20px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  display: grid;
  grid-template-areas:
    "value"
    "label"
    "change";
  align-content: center;
  justify-items: center;
  min-height: 164px;
  text-align: center;
  container-type: inline-size;
  transition: all var(--dur-normal) var(--ease);
  cursor: default;
  border: 1px solid rgba(17, 24, 39, 0.06);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--gray-200);
}

.stat-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 4px;
  transition: height var(--dur-normal) var(--ease);
}

.stat-card.primary::after { background: var(--stat-accent); }
.stat-card.success { --stat-accent: #10B981; }
.stat-card.danger { --stat-accent: #EF4444; }
.stat-card.warning { --stat-accent: #F59E0B; }
.stat-card.info { --stat-accent: #B45309; }
.stat-card.success::after,
.stat-card.danger::after,
.stat-card.warning::after,
.stat-card.info::after { background: var(--stat-accent); }

.stat-card:hover::after { height: 6px; }

.stat-card .stat-head {
  grid-area: label;
  display: flex; align-items: center;
  justify-content: center;
  min-width: 0;
  margin-top: clamp(6px, 3cqi, 10px);
}

.stat-card .stat-body {
  display: contents;
}

.stat-card .stat-value {
  grid-area: value;
  font-size: clamp(2rem, 14cqi, 3rem); font-weight: 800; line-height: 1;
  color: var(--gray-900); letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.stat-card.info .stat-value { color: var(--stat-accent); }

.stat-card .stat-label {
  min-width: 0;
  font-size: clamp(0.875rem, 5.5cqi, 1.125rem); font-weight: 600; line-height: 1.2;
  color: var(--gray-600); letter-spacing: 0;
}

.stat-card .stat-change {
  grid-area: change;
  font-size: clamp(0.6875rem, 3.8cqi, 0.8125rem); font-weight: 700; margin-top: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--radius-full);
}

.stat-change.up { background: var(--red-light); color: var(--red); }
.stat-change.down { background: var(--green-light); color: var(--green); }
.stat-change.neutral { background: var(--gray-100); color: var(--gray-500); }

/* ════════════════ Cards ════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 20px;
  overflow: hidden;
  transition: box-shadow var(--dur-normal) var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }

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

.card-title {
  font-size: 0.9375rem; font-weight: 700; color: var(--gray-900);
  display: flex; align-items: center; gap: 8px;
}

.card-body { padding: 20px 24px; }

/* ════════════════ Period Tabs ════════════════ */
.period-tabs {
  display: inline-flex; gap: 2px;
  background: var(--gray-100); border-radius: var(--radius-full);
  padding: 3px;
}

.period-tab {
  padding: 6px 16px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600; cursor: pointer;
  color: var(--gray-600); transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
}

.period-tab:hover { color: var(--gray-800); }

.period-tab.active {
  background: var(--surface); color: var(--brand-600);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
}

/* ════════════════ Chart ════════════════ */
.chart-wrap {
  width: 100%; padding: 8px 16px 0;
}

.chart-wrap canvas {
  width: 100%; height: 280px; display: block;
  border-radius: var(--radius-sm);
}

/* ════════════════ Compare Stats ════════════════ */
.compare-stats {
  padding: 20px 24px; border-top: 1px solid var(--gray-100);
  display: none;
}

.cmp-summary {
  display: flex; gap: 20px; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--gray-100);
  margin-bottom: 16px;
}

.cmp-main { text-align: center; min-width: 100px; }

.cmp-main .cmp-big {
  font-size: 2rem; font-weight: 800; color: var(--gray-900);
  display: block; line-height: 1;
}

.cmp-main .cmp-label {
  font-size: 0.6875rem; color: var(--gray-500);
  margin-top: 4px;
}

.cmp-arrow {
  font-size: 1.5rem; color: var(--gray-400);
}

.cmp-delta {
  font-size: 0.875rem; font-weight: 800;
  padding: 4px 12px; border-radius: var(--radius-full);
}

.cmp-delta.up { background: var(--red-light); color: var(--red); }
.cmp-delta.down { background: var(--green-light); color: var(--green); }

.cmp-breakdown {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}

.cmp-cell {
  text-align: center; padding: 16px 12px;
  background: var(--gray-50); border-radius: var(--radius-md);
  transition: background var(--dur-fast);
}

.cmp-cell:hover { background: var(--gray-100); }

.cmp-cell .cmp-cell-icon { font-size: 1.25rem; margin-bottom: 8px; }
.cmp-cell .cmp-cell-label { font-size: 0.6875rem; color: var(--gray-500); display: block; }
.cmp-cell .cmp-cell-value { font-size: 0.8125rem; font-weight: 700; color: var(--gray-800); margin: 4px 0; }
.cmp-cell .cmp-cell-change { font-size: 0.75rem; font-weight: 700; }

/* ════════════════ Tables ════════════════ */
.table-scroll { overflow-x: auto; border-radius: var(--radius-sm); }

table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; min-width: 500px; }

thead { position: sticky; top: 0; z-index: 1; }

th {
  padding: 11px 16px; text-align: left;
  background: var(--gray-50); color: var(--gray-500);
  font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; white-space: nowrap;
  border-bottom: 2px solid var(--gray-200);
}

td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }

tbody tr { transition: background var(--dur-fast); }
tbody tr:hover { background: var(--brand-50); }

tr.row-danger { background: var(--red-light) !important; }
tr.row-danger:hover { background: #FADBD8 !important; }
tr.row-warning { background: var(--amber-light) !important; }

.empty-cell {
  text-align: center; color: var(--gray-500); padding: 48px 16px !important;
  font-size: 0.8125rem;
}

.empty-cell .empty-icon { font-size: 2.5rem; display: block; margin-bottom: 12px; }

code {
  font-family: var(--font-mono); font-size: 0.75rem;
  background: var(--gray-100); color: var(--gray-700);
  padding: 2px 8px; border-radius: var(--radius-xs);
  font-weight: 500; letter-spacing: 0.02em;
}

/* ════════════════ Badges ════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 12px; border-radius: var(--radius-full);
  font-size: 0.6875rem; font-weight: 700; line-height: 1.4;
  white-space: nowrap; letter-spacing: 0.01em;
}

.badge-good { background: var(--green-light); color: #0B6E3A; }
.badge-damaged { background: var(--red-light); color: #B71C1C; }
.badge-shortage { background: var(--amber-light); color: #BF6A02; }
.badge-unknown { background: #FFF3E0; color: #B45309; }
.badge-dispatch { background: var(--brand-100); color: var(--brand-600); }
.badge-default { background: var(--gray-100); color: var(--gray-600); }
.badge-pending { background: #EFF4FF; color: #1D4ED8; }
.badge-notified { background: #E7F8F0; color: #047857; }
.badge-claimed { background: var(--green-light); color: var(--green); }
.badge-timeout { background: var(--red-light); color: #B71C1C; }
.badge-discarded { background: #ECEFF1; color: #546E7A; }

/* ════════════════ Rank Badge ════════════════ */
.rank-badge {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 800;
  background: var(--gray-100); color: var(--gray-500);
}

.rank-badge.top1 { background: linear-gradient(135deg, #EF4444, #B91C1C); color: #FFF; }
.rank-badge.top2 { background: linear-gradient(135deg, #F59E0B, #D97706); color: #FFF; }
.rank-badge.top3 { background: linear-gradient(135deg, #3B82F6, #1D4ED8); color: #FFF; }

/* ════════════════ Progress Bar ════════════════ */
.progress-bar {
  height: 6px; background: var(--gray-100); border-radius: 3px;
  overflow: hidden; width: 80px; display: inline-block; vertical-align: middle;
}

.progress-bar .fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-600));
  transition: width 0.6s var(--ease);
}

/* ════════════════ Mini Bar (排名进度条) ════════════════ */
.mini-bar {
  width: 100%; max-width: 120px; height: 8px;
  background: var(--gray-100); border-radius: 4px;
  overflow: hidden; display: inline-block; vertical-align: middle;
}

.mini-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
  transition: width 0.6s var(--ease);
}

/* ════════════════ Modal ════════════════ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; animation: fadeIn var(--dur-fast);
  backdrop-filter: blur(2px);
}

.modal.active { display: flex; }

.modal-content {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 28px 32px; max-width: 560px; width: 92%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalSlideIn var(--dur-normal) var(--ease-spring);
}

@keyframes modalSlideIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-100); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--gray-500);
  transition: all var(--dur-fast);
}

.modal-close:hover { background: var(--gray-200); color: var(--gray-700); }

/* ════════════════ Toast ════════════════ */
.toast {
  position: fixed; top: 24px; right: 24px;
  padding: 14px 24px; border-radius: var(--radius-md);
  font-size: 0.8125rem; font-weight: 600; z-index: 9999;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.35s var(--ease-spring);
  max-width: 380px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
}

.toast.show { transform: translateX(0); }

.toast-success { background: #10B981; color: #FFF; }
.toast-error { background: var(--red); color: #FFF; }
.toast-info { background: var(--brand-600); color: #FFF; }
.toast-warning { background: var(--amber); color: #FFF; }

/* ════════════════ Drop Zone ════════════════ */
.drop-zone {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--gray-400); border-radius: var(--radius-lg);
  padding: 56px 24px; text-align: center; cursor: pointer;
  transition: all var(--dur-normal) var(--ease);
  background: var(--gray-50);
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  min-height: 240px;
  position: relative;
}

.drop-zone:hover,
.drop-zone.dz-dragover {
  border-color: var(--brand-500); background: var(--brand-50);
  transform: translateY(-1px);
}

.drop-zone.dz-dragover {
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

.drop-zone:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.drop-zone .dz-icon {
  font-size: 3rem; margin-bottom: 16px; display: block;
  line-height: 1;
}

.drop-zone .dz-text {
  font-size: 1rem; font-weight: 700; color: var(--gray-800);
  margin-bottom: 8px; display: block;
  line-height: 1.4;
}

.drop-zone .dz-hint {
  font-size: 0.75rem; color: var(--gray-500); display: block;
  line-height: 1.4;
}

.drop-zone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
  top: 0; left: 0;
}

/* ════════════════ Forms ════════════════ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }

.form-input, .form-select {
  width: 100%; height: 40px; padding: 0 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 0.8125rem; color: var(--gray-800); background: var(--surface);
  outline: none; transition: all var(--dur-fast);
}

.form-input:focus, .form-select:focus {
  border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-select { appearance: none; padding-right: 32px; cursor: pointer; }

.form-row {
  display: flex; gap: 12px; align-items: center; margin-bottom: 16px;
}

.form-row label { font-size: 0.8125rem; font-weight: 600; color: var(--gray-600); white-space: nowrap; }

.form-row input, .form-row select {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 0.8125rem; outline: none; transition: all var(--dur-fast);
}

.form-row input:focus, .form-row select:focus {
  border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ════════════════ Export / Import Panel ════════════════ */
.export-panel, .import-panel { padding: 4px 0; }

.info-box {
  background: var(--brand-50); border: 1px solid var(--brand-100);
  border-radius: var(--radius-sm); padding: 16px 20px;
  font-size: 0.8125rem; color: var(--gray-700); line-height: 1.8;
}

.info-box strong { color: var(--gray-900); }

.info-box a { color: var(--brand-600); font-weight: 600; text-decoration: underline; }

.export-image-option {
  display: flex; align-items: flex-start; gap: 10px;
  max-width: 620px; padding: 12px 14px;
  border: 1px solid var(--brand-100); border-radius: var(--radius-sm);
  background: var(--brand-50); cursor: pointer;
}

.export-image-option input { margin-top: 3px; accent-color: var(--brand-600); }
.export-image-option span { display: flex; flex-direction: column; gap: 2px; }
.export-image-option strong { color: var(--gray-900); font-size: 0.8125rem; }
.export-image-option small { color: var(--gray-500); font-size: 0.75rem; line-height: 1.5; }

.import-mode-panel {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; margin-bottom: 16px;
}

.import-mode-panel label {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); cursor: pointer; background: #fff;
}

.import-mode-panel label:has(input:checked) {
  border-color: var(--brand-500); background: var(--brand-50);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.08);
}

.import-mode-panel input { margin-top: 3px; accent-color: var(--brand-600); }
.import-mode-panel span { display: flex; flex-direction: column; gap: 3px; }
.import-mode-panel strong { color: var(--gray-900); font-size: 0.8125rem; }
.import-mode-panel small { color: var(--gray-500); font-size: 0.75rem; line-height: 1.4; }

.import-loading, .import-error {
  padding: 14px 16px; border-radius: var(--radius-sm); font-size: 0.8125rem;
}
.import-loading { color: var(--brand-700); background: var(--brand-50); }
.job-kpi-progress-label {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  color: #173f91; font-weight: 700;
}
.job-kpi-progress-label strong { flex: 0 0 auto; color: var(--brand-700); font-variant-numeric: tabular-nums; }
.job-kpi-progress-track {
  width: 100%; height: 12px; margin-top: 10px; overflow: hidden;
  border: 1px solid rgba(37, 99, 235, .22); border-radius: 999px; background: #dbe7ff;
  box-shadow: inset 0 1px 2px rgba(37, 99, 235, .08);
}
.job-kpi-progress-fill {
  display: block; height: 100%; min-width: 8px; border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  box-shadow: 0 0 10px rgba(37, 99, 235, .42);
  transition: width .25s ease;
}
.job-kpi-progress-track.is-indeterminate .job-kpi-progress-fill { animation: job-kpi-progress-slide 1.15s ease-in-out infinite; }
@keyframes job-kpi-progress-slide {
  from { transform: translateX(-105%); }
  to { transform: translateX(295%); }
}
.import-error { color: var(--red); background: var(--red-light); }
.import-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-size: 0.8125rem;
}
.import-summary div:first-child { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.import-ok { color: var(--green); font-weight: 700; }
.import-bad { color: var(--red); font-weight: 700; }
.import-muted { color: var(--gray-500); font-size: 0.75rem; }
.import-preview-table { max-height: 360px; border: 1px solid var(--gray-200); border-top: 0; }
.import-preview-table td { white-space: normal; min-width: 110px; }
.import-preview-table td:last-child { min-width: 240px; }
.import-row-error { background: var(--red-light) !important; }
.import-row-ok td:last-child { color: var(--green); font-weight: 600; }
.job-kpi-import-controls { margin-top: 12px; }
.job-kpi-import-controls[hidden],
.job-kpi-import-controls .import-actions[hidden],
.job-kpi-import-controls .job-kpi-import-status[hidden],
.job-kpi-import-controls .import-action-hint[hidden] { display: none !important; }
.import-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.job-kpi-import-controls .import-actions { margin-top: 0; }
.import-action-hint { margin-right: auto; align-self: center; color: #bd2f2f; font-size: .78rem; font-weight: 650; }
.import-ignore-notice { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(37, 99, 235, .14); border-radius: 10px; color: #315a9f; background: #f2f6ff; font-size: .78rem; }
.import-error-details { margin-top: 12px; padding: 12px 14px; border: 1px solid rgba(239, 68, 68, .2); border-radius: 10px; color: #a92e2e; background: #fff4f4; font-size: .78rem; }
.import-error-details ul { margin: 7px 0 0 18px; }
.import-error-details li + li { margin-top: 4px; }
#jobKpiConfirmImportButton:disabled,
#jobKpiConfirmImportButton:disabled:hover {
  color: #7b8798;
  background: #dfe4ec;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  transform: none;
}

@media (max-width: 720px) {
  .import-actions { flex-wrap: wrap; }
  .import-action-hint { flex: 1 0 100%; }
}

.job-kpi-import-status {
  margin-top: 14px;
  padding: 13px 16px;
  border: 1px solid rgba(37, 99, 235, .14);
  border-radius: 10px;
  color: #244a9b;
  background: #f1f5ff;
  font-size: .8125rem;
  font-weight: 650;
}
.job-kpi-import-status:not(.success):not(.error) { border-color: rgba(37, 99, 235, .24); background: #eef4ff; }
.job-kpi-import-status.success { border-color: rgba(16, 185, 129, .2); color: #087553; background: #ecf9f4; }
.job-kpi-import-status.error { border-color: rgba(239, 68, 68, .2); color: #bd2f2f; background: #fff1f1; }
.job-kpi-import-history {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(20, 32, 56, .08);
}
.job-kpi-import-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.job-kpi-import-history-head h3 { color: #1c273a; font-size: .95rem; line-height: 1.3; }
.job-kpi-import-history-head p { margin-top: 4px; color: #6f7c91; font-size: .75rem; }
.job-kpi-import-count {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  color: #2d5bd8;
  background: #edf3ff;
  font-size: .72rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.job-kpi-import-history-list { display: grid; gap: 8px; }
.job-kpi-import-record {
  display: grid;
  grid-template-columns: 92px minmax(220px, 1fr) minmax(220px, auto) 116px 76px;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid rgba(20, 32, 56, .07);
  border-radius: 12px;
  background: #fbfcfe;
  box-shadow: 0 1px 3px rgba(20, 34, 64, .04);
}
.job-kpi-import-file-index {
  color: #2d5bd8;
  font-size: .8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.job-kpi-import-file-main { min-width: 0; }
.job-kpi-import-file-main strong {
  display: block;
  overflow: hidden;
  color: #232b3a;
  font-size: .82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-kpi-import-file-main small { display: block; margin-top: 3px; color: #7a8699; font-size: .7rem; }
.job-kpi-import-file-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; color: #566175; font-size: .72rem; }
.job-kpi-import-file-stats span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-kpi-import-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #1f5f48;
  background: rgba(16, 185, 129, .1);
  font-size: .7rem;
  font-weight: 750;
  white-space: nowrap;
}
.job-kpi-import-state.processing { color: #315ea8; background: rgba(37, 99, 235, .09); }
.job-kpi-import-state.failed { color: #b83232; background: rgba(239, 68, 68, .1); }
.job-kpi-import-delete {
  min-width: 68px;
  min-height: 44px;
  border: 1px solid rgba(239, 68, 68, .2);
  border-radius: 10px;
  color: #c73535;
  background: #fff7f7;
  cursor: pointer;
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
}
.job-kpi-import-delete:hover { color: #a91f1f; background: #ffeded; }
.job-kpi-import-delete:focus-visible { outline: 3px solid rgba(239, 68, 68, .2); outline-offset: 2px; }
.job-kpi-import-empty { padding: 28px 12px; color: #7a8699; background: #f7f9fc; border-radius: 12px; text-align: center; }
.job-kpi-history-divider {
  padding: 8px 4px 2px;
  color: #6f7c91;
  font-size: .75rem;
  font-weight: 750;
}
.job-kpi-expand-toggle {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-top: 1px solid rgba(45, 91, 216, .12);
  color: #2d5bd8;
  background: #f7f9ff;
  cursor: pointer;
  font: inherit;
  font-size: .75rem;
  font-weight: 750;
}
.job-kpi-expand-toggle:hover { background: #edf3ff; }
.job-kpi-expand-toggle:focus-visible { outline: 3px solid rgba(45, 91, 216, .2); outline-offset: -3px; }
.job-kpi-expand-toggle[hidden] { display: none; }

@media (max-width: 980px) {
  .job-kpi-import-record { grid-template-columns: 86px minmax(180px, 1fr) auto; }
  .job-kpi-import-file-stats { grid-column: 2 / -1; }
  .job-kpi-import-delete { grid-column: 3; grid-row: 1; }
  .job-kpi-import-state { grid-column: 1; grid-row: 2; }
}

@media (max-width: 620px) {
  .job-kpi-import-history-head { align-items: center; }
  .job-kpi-import-record { grid-template-columns: 1fr auto; gap: 10px; }
  .job-kpi-import-file-index { grid-column: 1; }
  .job-kpi-import-file-main { grid-column: 1 / -1; }
  .job-kpi-import-file-stats { grid-column: 1 / -1; }
  .job-kpi-import-state { grid-column: 1; grid-row: auto; justify-self: start; }
  .job-kpi-import-delete { grid-column: 2; grid-row: 1; }
}

/* ════════════════ Detail Grid ════════════════ */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin: 18px 0;
}

.detail-grid .dg-item { padding: 8px 0; }

.detail-grid .dg-label {
  font-size: 0.6875rem; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: 0.04em; display: block;
  margin-bottom: 2px;
}

.detail-grid .dg-value { font-size: 0.875rem; font-weight: 600; color: var(--gray-800); }

/* ════════════════ Section Divider ════════════════ */
.section-divider {
  height: 1px; background: var(--gray-200);
  margin: 20px 0;
}

/* ════════════════ Utility ════════════════ */
.text-danger { color: var(--red); font-weight: 600; }
.text-success { color: var(--green); font-weight: 600; }
.text-muted { color: var(--gray-500); }

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.text-center { text-align: center; }

/* ════════════════ Responsive ════════════════ */
@media (max-width: 1280px) {
  .stats-row { grid-template-columns: repeat(5, 1fr); gap: 12px; }
  .stat-card { padding: 18px 16px; }
}

@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .search-box { width: 200px; }
}

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar-header { padding: 16px 12px; }
  .sidebar-header .logo-icon { width: 40px; height: 40px; flex-basis: 40px; }
  .sidebar-header .logo-text, .sidebar-header .version-badge, .nav-tab span:not(.nav-icon), .nav-group-label, .nav-region-empty { display: none; }
  .nav-region { padding: 0 8px 4px; border-bottom: 0; }
  .nav-region[data-nav-region="finance"] { display: none; }
  .nav-tab { justify-content: center; padding: 12px; }
  .nav-tab .nav-icon { margin: 0; }
  .nav-tab .nav-badge { display: none; }
  .sidebar-footer { justify-content: center; font-size: 0; }
  .sidebar-footer .status-dot { margin: 0; }

  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .search-box { width: 160px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 16px; }
}

@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar-left { flex-wrap: wrap; }
  .cmp-summary { flex-direction: column; }
  .cmp-breakdown { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .search-box { width: 100%; }
}

/* ════════════════ 组合图片缩略图 ════════════════ */
.thumb-row {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}

.combo-thumb {
  width: 40px; height: 40px; border-radius: var(--radius-xs);
  object-fit: cover; cursor: pointer;
  border: 1px solid var(--gray-200);
  transition: all var(--dur-fast) var(--ease);
}

.combo-thumb:hover {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
  transform: scale(1.1);
}

.thumb-more {
  font-size: 0.6875rem; font-weight: 700; color: var(--gray-500);
  padding: 2px 6px; background: var(--gray-100);
  border-radius: var(--radius-xs); white-space: nowrap;
}

.no-img {
  font-size: 0.6875rem; color: var(--gray-400); font-style: italic;
}

/* ════════════════ 详情页图片 ════════════════ */
.detail-thumb {
  width: 60px; height: 60px; border-radius: var(--radius-sm);
  object-fit: cover; cursor: pointer;
  border: 1px solid var(--gray-200);
  transition: all var(--dur-fast) var(--ease);
}

.detail-thumb:hover {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
  transform: scale(1.08);
}

.detail-thumb-row {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}

/* ════════════════ 图片画廊查看器 ════════════════ */
.gallery-viewer {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0;
}

.gallery-img-wrap {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 300px; max-height: 70vh; margin-bottom: 12px;
}

.gallery-img {
  max-width: 100%; max-height: 70vh; border-radius: var(--radius-md);
  object-fit: contain; box-shadow: var(--shadow-lg);
}

.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,0.5); color: #FFF;
  border: none; cursor: pointer; font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast); line-height: 1;
}

.gallery-nav:hover { background: rgba(0,0,0,0.7); transform: translateY(-50%) scale(1.1); }
.gallery-nav.prev { left: 8px; }
.gallery-nav.next { right: 8px; }

.gallery-counter {
  font-size: 0.8125rem; font-weight: 600; color: var(--gray-600);
  padding: 4px 16px; background: var(--gray-100);
  border-radius: var(--radius-full); margin-bottom: 8px;
}

/* 图片弹窗时让modal-content更宽 */
.modal:has(.gallery-viewer) .modal-content {
  max-width: 800px;
}

/* ════════════════ WEB 扫码登录门 ════════════════ */
.login-gate {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #2563EB 100%);
  backdrop-filter: blur(4px);
}
.login-card {
  background: #FFF; border-radius: var(--radius-lg);
  padding: 36px 44px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  width: 360px; max-width: 90vw;
}
.login-logo { font-size: 1.125rem; font-weight: 700; color: var(--gray-800); margin-bottom: 18px; }
.login-title { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); margin: 0 0 6px; }
.login-sub { font-size: 0.8125rem; color: var(--gray-500); margin: 0 0 20px; }
.qr-wrap {
  width: 200px; height: 200px; margin: 0 auto 16px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.qr-loading, .qr-fallback { font-size: 0.75rem; color: var(--gray-500); padding: 12px; word-break: break-all; }
.mini-program-code { display: block; width: 200px; height: 200px; object-fit: contain; }
.login-tip { font-size: 0.6875rem; color: var(--gray-400); margin: 0; }
.login-status { font-size: 0.75rem; color: var(--gray-400); margin: 0 0 0.5rem 0; padding: 0.375rem 0.625rem; background: rgba(37,99,235,0.08); border-radius: 0.375rem; text-align: center; line-height: 1.4; word-break: break-all; }
.login-status.success { color: var(--success); background: rgba(16,185,129,0.1); }
.login-status.error { color: var(--danger); background: rgba(239,68,68,0.1); }
.login-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.primary-btn {
  background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-md); padding: 10px 18px;
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  width: 100%;
}
.primary-btn:hover { background: var(--primary-dark); }


.login-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.75rem; color: var(--gray-700);
  background: var(--gray-100); padding: 4px 12px; border-radius: var(--radius-full);
}
.role-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.role-dot.role-developer { background: #7C3AED; }
.role-dot.role-admin { background: #2563EB; }
.role-dot.role-operator { background: #F59E0B; }
.role-dot.role-customer { background: #10B981; }
.login-name { font-weight: 600; }
.link-btn { background: none; border: none; color: var(--brand-600); cursor: pointer; font-size: 0.75rem; padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* 角色徽章（账号管理） */
.badge-dev { background: #EDE9FE; color: #6D28D; }
.badge-admin { background: var(--brand-100); color: var(--brand-600); }
.badge-op { background: #FEF3C7; color: #B45309; }
.badge-cus { background: var(--green-light); color: #047857; }

/* 按钮尺寸 */
.btn-xs { height: 26px; padding: 0 10px; font-size: 0.6875rem; border-radius: var(--radius-full); }

.role-select {
  height: 30px; padding: 0 8px; font-size: 0.75rem;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: #FFF; color: var(--gray-700); cursor: pointer;
}
.oid-cell { font-size: 0.6875rem; color: var(--gray-500); }

/* 退件规则配置 */
.badge-danger { background: var(--red-light); color: #B71C1C; }
.form-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 14px;
  align-items: center;
}
.form-grid .form-label { margin-bottom: 0; }
.form-grid .form-input { width: 100%; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.op-cell { white-space: nowrap; }
.op-cell .link-btn { margin-right: 6px; }
.link-btn.danger { color: #DC2626; }

/* 快递查询 */
.express-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding: 12px 14px;
  background: var(--gray-50, #F8FAFC);
  border: 1px solid var(--gray-200, #E2E8F0);
  border-radius: var(--radius-md, 10px);
  margin-bottom: 14px;
}
.express-label { color: var(--gray-500); font-size: 0.75rem; margin-right: 6px; }
.express-head code { font-size: 0.875rem; color: var(--brand-600); }
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px;
  width: 2px; background: var(--gray-200, #E2E8F0);
}
.tl-item { position: relative; padding: 0 0 16px 6px; }
.tl-dot {
  position: absolute; left: -18px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-500, #3B82F6); border: 2px solid #FFF;
  box-shadow: 0 0 0 1px var(--brand-200, #BFDBFE);
}
.tl-body { }
.tl-text { font-size: 0.875rem; color: var(--gray-800); line-height: 1.5; }
.tl-meta { font-size: 0.75rem; color: var(--gray-500); margin-top: 2px; }

/* ════════════════ 连接诊断横幅 ════════════════ */
.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #FFF7ED; border-bottom: 1px solid #FDBA74; color: #9A3412;
  padding: 10px 18px 12px; font-size: 13px; line-height: 1.5;
  box-shadow: 0 2px 10px rgba(0,0,0,.10);
  max-height: 60vh; overflow-y: auto;
}
.conn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.conn-head strong { color: #C2410C; }
.conn-close {
  border: none; background: transparent; color: #9A3412; font-size: 20px;
  line-height: 1; cursor: pointer; padding: 0 4px; flex: 0 0 auto;
}
.conn-close:hover { color: #7C2D12; }
.conn-line { margin-top: 4px; }
.conn-line code, .conn-steps code, .conn-head code {
  background: #FFEDD5; padding: 1px 6px; border-radius: 4px; font-size: 12px;
}
.conn-steps { margin: 6px 0 0 18px; padding: 0; }
.conn-steps li { margin: 3px 0; }
.conn-actions { margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.conn-actions input {
  height: 30px; border: 1px solid #FDBA74; border-radius: 6px;
  padding: 0 8px; font-size: 12px; width: 220px;
}
.conn-actions input:focus { outline: none; border-color: #F97316; }

/* ════════════════ 多仓与 WEB OCR ════════════════ */
.warehouse-select {
  min-width: 150px;
  max-width: 240px;
  height: 34px;
  font-weight: 600;
  color: var(--brand-600);
  border-color: var(--brand-200, #BFDBFE);
}

.ocr-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr);
  gap: 24px;
  align-items: start;
}

.ocr-upload-panel,
.ocr-form-panel,
.warehouse-tool {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 18px;
}

.ocr-preview {
  min-height: 300px;
  margin: 14px 0;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  cursor: zoom-in;
  overflow: hidden;
}

.ocr-preview img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.ocr-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #EFF6FF;
  color: #1D4ED8;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.ocr-status.error { background: #FEF2F2; color: #B91C1C; }
.ocr-status.success { background: #ECFDF5; color: #047857; }
.ocr-raw { margin-top: 12px; font-size: 0.8125rem; color: var(--gray-600); }
.ocr-raw pre {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}

.ocr-form-panel .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.ocr-form-panel .form-group { margin: 0; }
.ocr-form-panel .form-group label,
.warehouse-invite-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
}

.ocr-form-panel textarea.form-input { height: auto; min-height: 74px; padding: 10px 14px; resize: vertical; }
.ocr-form-panel .file-input { height: auto; min-height: 40px; padding: 8px; }
.form-span-2 { grid-column: span 2; }
.ocr-save-btn { width: 100%; margin-top: 18px; height: 44px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.warehouse-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.warehouse-tool h4 { margin: 0 0 12px; color: var(--gray-800); }
.inline-form,
.warehouse-bind-form,
.warehouse-invite-form,
.invite-result {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form .form-input,
.warehouse-bind-form .form-input,
.warehouse-bind-form .form-select,
.invite-result .form-input { flex: 1 1 220px; }
.warehouse-invite-form .form-group { min-width: 150px; margin-bottom: 0; }
.invite-result {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--brand-200, #BFDBFE);
  border-radius: var(--radius-sm);
  background: #EFF6FF;
}
.warehouse-cell-select { min-width: 140px; height: 30px; font-size: 0.75rem; }

@media (max-width: 960px) {
  .ocr-layout { grid-template-columns: 1fr; }
  .warehouse-create-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .ocr-form-panel .form-grid { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: span 1; }
  .ocr-preview { min-height: 220px; }
  .warehouse-select { max-width: 150px; }
}

/* ════════════════ 作业 KPI ════════════════ */
.kpi-toolbar .card-header { align-items: flex-start; }
.kpi-toolbar-note {
  margin-top: 4px;
  color: var(--gray-500);
  font-size: .75rem;
}
.kpi-toolbar-actions { display: flex; gap: 8px; }
.job-kpi-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(135px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}
.job-kpi-filters label span {
  display: block;
  margin-bottom: 6px;
  color: var(--gray-600);
  font-size: .75rem;
  font-weight: 650;
}
.job-kpi-query { min-width: 88px; height: 40px; }
.job-kpi-periods {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(20, 32, 56, .07);
  border-radius: 10px;
  background: #f4f6fa;
}
.job-kpi-periods button {
  min-width: 64px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  color: #69768c;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
}
.job-kpi-periods button:hover,
.job-kpi-periods button.active {
  color: #2d5bd8;
  background: #fbfcfe;
  box-shadow: 0 1px 3px rgba(20, 34, 64, .08);
}
.job-kpi-periods button:focus-visible,
.job-kpi-query:focus-visible,
.kpi-toolbar-actions button:focus-visible {
  outline: 3px solid rgba(45, 91, 216, .22);
  outline-offset: 2px;
}
.job-kpi-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.job-kpi-metric {
  min-height: 120px;
  padding: 20px;
  border: 1px solid rgba(20, 32, 56, .07);
  border-top: 4px solid #2d5bd8;
  border-radius: 14px;
  background: #fbfcfe;
  box-shadow: 0 1px 3px rgba(20, 34, 64, .05);
}
.job-kpi-metric.metric-people { border-top-color: #2f7a55; }
.job-kpi-metric.metric-batches { border-top-color: #e08a2e; }
.job-kpi-metric.metric-average { border-top-color: #7c5bb5; }
.job-kpi-metric span { display: block; color: #69768c; font-size: .75rem; font-weight: 650; }
.job-kpi-metric strong {
  display: inline-block;
  margin-top: 12px;
  color: #121a2b;
  font-size: clamp(1.8rem, 2.2vw, 2.45rem);
  line-height: 1;
  letter-spacing: -.035em;
}
.job-kpi-metric small { margin-left: 6px; color: #69768c; font-size: .75rem; }
.job-kpi-grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(650px, 1fr);
  gap: 16px;
  align-items: start;
}
.job-kpi-ranking-column {
  display: grid;
  min-width: 0;
  gap: 12px;
  align-content: start;
}
.job-kpi-ranking-column > .job-kpi-periods {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}
.job-kpi-ranking-list { padding: 4px 18px 14px; }
.job-kpi-ranking-list .job-kpi-expand-toggle { margin-top: 8px; border-radius: 8px; }
.job-kpi-ranking-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 18px 10px;
  overflow: hidden;
  border: 1px solid #c8d6ef;
  border-radius: 9px;
}
.job-kpi-ranking-tabs button {
  height: 36px;
  border: 0;
  border-right: 1px solid #dce4f3;
  color: #2d5bd8;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: .75rem;
  font-weight: 750;
}
.job-kpi-ranking-tabs button:last-child { border-right: 0; }
.job-kpi-ranking-tabs button.active { color: #fff; background: #2d5bd8; }
.job-kpi-ranking-tabs button:focus-visible { position: relative; outline: 3px solid rgba(45, 91, 216, .22); outline-offset: -3px; }
.job-kpi-rank-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  border-bottom: 1px solid rgba(20, 32, 56, .06);
}
.job-kpi-rank-row:last-child { border-bottom: 0; }
.job-kpi-rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: #566175;
  background: #eceff3;
  font-size: .72rem;
  font-weight: 800;
}
.job-kpi-rank.rank-1 { color: #4f3104; background: #f8d781; }
.job-kpi-rank.rank-2 { color: #334155; background: #dce2e9; }
.job-kpi-rank.rank-3 { color: #fff8ee; background: #b7793d; }
.job-kpi-person { min-width: 0; }
.job-kpi-person strong { display: block; overflow: hidden; color: #23272f; text-overflow: ellipsis; white-space: nowrap; }
.job-kpi-person small { color: #6f7c91; }
.job-kpi-person-total { color: #566175; font-size: .7rem; text-align: right; }
.job-kpi-person-total strong { display: block; color: #2d5bd8; font-size: 1.1rem; }
.job-kpi-worker-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  color: #2f6b4f;
  background: rgba(47, 107, 79, .10);
  font-size: .62rem;
  font-weight: 700;
}
.job-kpi-worker-tag.temp { color: #98600d; background: rgba(224, 138, 46, .13); }
.job-kpi-batches table { min-width: 1050px; }
.job-kpi-batches > .job-kpi-expand-toggle { border-radius: 0 0 12px 12px; }
.job-kpi-batches td { vertical-align: top; }
.job-kpi-batch-row { cursor: pointer; }
.job-kpi-batch-row:hover td { background: #f3f7ff; }
.job-kpi-product-cell { min-width: 230px; max-width: 360px; white-space: normal; line-height: 1.45; }
.job-kpi-participant-cell { min-width: 210px; white-space: normal; color: #566175; line-height: 1.55; }
.job-kpi-quantity { color: #2d5bd8; font-size: 1rem; font-weight: 800; }
.kpi-empty { padding: 48px 12px; color: #6f7c91; text-align: center; }
.job-kpi-detail-people { margin: 0; padding-left: 18px; }
.job-kpi-detail-people li + li { margin-top: 6px; }

@media (max-width: 1280px) {
  .job-kpi-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .job-kpi-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .job-kpi-filters { grid-template-columns: 1fr 1fr; }
  .job-kpi-metrics { grid-template-columns: 1fr 1fr; }
  .kpi-toolbar .card-header { gap: 12px; flex-direction: column; }
}
