/* ==========================================================================
   快递流转管家 (Package Flow Manager) - 7阶与打叉双态现代高级样式
   ========================================================================== */

:root {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-translucent: rgba(255, 255, 255, 0.88);
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;

  --border-light: #e2e8f0;
  --border-subtle: #cbd5e1;
  --border-focus: #4f46e5;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --primary-glow: rgba(79, 70, 229, 0.22);

  /* 7阶专属色彩系统 */
  --s1-color: #d97706;
  /* 1. 物业 (琥珀) */
  --s1-bg: #fef3c7;
  --s2-color: #ea580c;
  /* 2. 门口 (暖橙) */
  --s2-bg: #ffedd5;
  --s3-color: #0284c7;
  /* 3. 房内 (海蓝) */
  --s3-bg: #e0f2fe;
  --s4-color: #4f46e5;
  /* 4. 发往转运 (在途靛) */
  --s4-bg: #e0e7ff;
  --s5-color: #7c3aed;
  /* 5. 转运公司 (仓储紫) */
  --s5-bg: #ede9fe;
  --s6-color: #0d9488;
  /* 6. 发往澳洲 (国际青) */
  --s6-bg: #ccfbf1;
  --s7-color: #059669;
  /* 7. 澳洲 (送达绿) */
  --s7-bg: #d1fae5;

  /* 打叉/跳过状态色 */
  --crossed-color: #ef4444;
  --crossed-bg: #fee2e2;
  --crossed-border: #fca5a5;

  --danger: #ef4444;
  --danger-light: #fee2e2;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-surface-translucent: rgba(17, 24, 39, 0.88);
  --bg-card: #141d2e;
  --bg-subtle: #1e293b;
  --bg-hover: #2d3b55;

  --border-light: #243048;
  --border-subtle: #334155;
  --border-focus: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #090d16;

  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-light: rgba(99, 102, 241, 0.2);
  --primary-glow: rgba(99, 102, 241, 0.4);

  --s1-color: #fbbf24;
  --s1-bg: rgba(251, 191, 36, 0.15);
  --s2-color: #fb923c;
  --s2-bg: rgba(251, 146, 60, 0.15);
  --s3-color: #38bdf8;
  --s3-bg: rgba(56, 189, 248, 0.15);
  --s4-color: #818cf8;
  --s4-bg: rgba(129, 140, 248, 0.15);
  --s5-color: #a78bfa;
  --s5-bg: rgba(167, 139, 250, 0.15);
  --s6-color: #2dd4bf;
  --s6-bg: rgba(45, 212, 191, 0.15);
  --s7-color: #34d399;
  --s7-bg: rgba(52, 211, 153, 0.15);

  --crossed-color: #f87171;
  --crossed-bg: rgba(248, 113, 113, 0.15);
  --crossed-border: rgba(248, 113, 113, 0.3);

  --danger: #f87171;
  --danger-light: rgba(239, 68, 68, 0.2);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: var(--bg-surface-translucent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 14px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
  flex-shrink: 0;
}

.logo-icon {
  width: 24px;
  height: 24px;
}

.header-title-wrap {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-version {
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.app-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* JSON 磁盘落盘状态图标按钮 (仅图标，悬停或点击显示说明) */
.disk-sync-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.disk-sync-btn:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.disk-sync-btn.is-offline {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

.disk-icon {
  width: 17px;
  height: 17px;
}

.disk-status-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.9);
  animation: pulseDot 2s infinite;
}

.disk-sync-btn.is-offline .disk-status-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.9);
}

@keyframes pulseDot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  box-sizing: border-box;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(0.4);
}

.btn:active {
  transform: scale(0.98);
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #ffffff;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary-light);
}

.btn-outline-purple {
  background: transparent;
  color: var(--s5-color);
  border-color: var(--s5-color);
}

.btn-outline-purple:hover {
  background: var(--s5-bg);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-success {
  background: #10b981;
  color: #ffffff;
}

.btn-success:hover {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  height: 28px;
  padding: 4px 10px;
  font-size: 0.8125rem;
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.shadow-glow {
  box-shadow: 0 4px 14px var(--primary-glow);
}

.theme-icon {
  width: 18px;
  height: 18px;
}

body[data-theme="light"] .icon-sun {
  display: none;
}

body[data-theme="light"] .icon-moon {
  display: block;
}

body[data-theme="dark"] .icon-sun {
  display: block;
}

body[data-theme="dark"] .icon-moon {
  display: none;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
}

@media (max-width: 1400px) {
  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

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

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-card.card-hero {
  justify-content: space-between;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.metric-card[data-stat="total"]::before {
  background: linear-gradient(90deg, var(--primary), #7c3aed);
}

.metric-card[data-stat="property"]::before {
  background: var(--s1-color);
}

.metric-card[data-stat="doorstep"]::before {
  background: var(--s2-color);
}

.metric-card[data-stat="indoor"]::before {
  background: var(--s3-color);
}

.metric-card[data-stat="to_fwd"]::before {
  background: var(--s4-color);
}

.metric-card[data-stat="fwd_hub"]::before {
  background: var(--s5-color);
}

.metric-card[data-stat="to_au"]::before {
  background: var(--s6-color);
}

.metric-card[data-stat="au_arrived"]::before {
  background: var(--s7-color);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.metric-pill {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.pill-neutral {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.pill-amber {
  background: var(--s1-bg);
  color: var(--s1-color);
}

.pill-blue {
  background: var(--s2-bg);
  color: var(--s2-color);
}

.pill-purple {
  background: var(--s3-bg);
  color: var(--s3-color);
}

.pill-indigo {
  background: var(--s4-bg);
  color: var(--s4-color);
}

.pill-sky {
  background: var(--s5-bg);
  color: var(--s5-color);
}

.pill-teal {
  background: var(--s6-bg);
  color: var(--s6-color);
}

.pill-emerald {
  background: var(--s7-bg);
  color: var(--s7-color);
}

.metric-value {
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1.1;
  font-feature-settings: "tnum";
}

.metric-value-dual {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1.1;
  font-feature-settings: "tnum";
}

.metric-slash {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 1.35rem;
  margin: 0 2px;
}

.metric-num-parcels {
  color: var(--text-primary);
}

.metric-num-items {
  color: var(--primary);
}

.dot-sep {
  margin: 0 4px;
  color: var(--text-muted);
}

.metric-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Flow Guide Bar */
.flow-guide-bar {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  gap: 8px;
}

.guide-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.guide-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.guide-arrow {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.badge-transit {
  font-size: 0.625rem;
  background: var(--s4-bg);
  color: var(--s4-color);
  padding: 1px 5px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.guide-tip-pill {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-primary);
  background: var(--bg-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Toolbar - PC端单行紧凑整合，手机端响应式拆分为两行 */
.toolbar-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
}

.toolbar-action-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  order: 1;
}

.toolbar-status-container {
  display: flex;
  align-items: center;
  flex-shrink: 1;
  min-width: 0;
  order: 2;
  overflow-x: auto;
  scrollbar-width: none;
}

.toolbar-status-container::-webkit-scrollbar {
  display: none;
}

.toolbar-status-container .filter-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 2px 3px;
  white-space: nowrap;
}

.toolbar-action-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  order: 3;
  margin-left: auto;
}

/* 搜索框：PC端收窄为 180px，聚焦时微展至 200px，确保整行舒适容纳 */
.search-input-wrapper {
  position: relative;
  width: 180px;
  min-width: 130px;
  transition: width var(--transition-fast);
}

.search-input-wrapper:focus-within {
  width: 200px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper input {
  width: 100%;
  height: 30px;
  padding: 0 26px 0 30px;
  font-size: 0.8125rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.search-input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.clear-search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* 排序选择器：与筛选按钮完全统一规格 (30px高，相同边框背景与下拉箭头) */
.sort-selector-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0 8px 0 10px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.sort-selector-wrapper:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.sort-selector-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.sort-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.sort-selector-wrapper:hover .sort-label {
  color: var(--text-primary);
}

.sort-select {
  border: none;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  padding: 0 1px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.sort-select::-ms-expand {
  display: none;
}

.sort-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sort-chevron-icon {
  color: var(--text-secondary);
  pointer-events: none;
  flex-shrink: 0;
  margin-left: 2px;
}

/* 高级多维筛选下拉弹出面板 (支持复选多选) */
.filter-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.filter-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.filter-trigger-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.filter-trigger-btn.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.filter-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--primary);
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.8);
}

.filter-popover-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 380px;
  max-width: 95vw;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 999;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeInDown 0.16s ease-out;
}

.filter-popover-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

.filter-category-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.25));
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px;
  width: 100%;
}

.filter-cat-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 5px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-cat-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.filter-cat-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}

.filter-cat-badge {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  line-height: 1;
}

.filter-cat-btn:not(.active) .filter-cat-badge {
  background: var(--primary);
  color: #fff;
}

.btn-filter-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-filter-reset:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

body[data-theme="dark"] .btn-filter-reset {
  background: var(--bg-subtle, #1e293b);
  color: var(--text-secondary, #94a3b8);
  border-color: var(--border-light, #243048);
}

body[data-theme="dark"] .btn-filter-reset:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
}

.filter-popover-body {
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.filter-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-pane-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}

.filter-pane-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-search-box {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  flex: 1;
  max-width: 200px;
}

.filter-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.75rem;
  color: var(--text-primary);
  width: 100%;
}

.filter-pane-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.action-divider {
  color: var(--border-light);
  font-size: 0.7rem;
}

.btn-group-action {
  background: none;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  padding: 1px 3px;
}

.btn-group-action:hover {
  text-decoration: underline;
}

.filter-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}

.filter-pane-scroll {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}

.filter-chip-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.filter-chip-card:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.filter-chip-card.is-selected {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.filter-chip-card input[type="checkbox"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.filter-chip-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
}

.filter-chip-card.is-selected .filter-chip-name {
  font-weight: 600;
  color: var(--primary);
}

.filter-chip-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.filter-chip-card.is-selected .filter-chip-badge {
  color: var(--primary);
}

.filter-merchant-unset-card {
  border-style: dashed;
}

.filter-merchant-unset-card.is-selected {
  border-style: solid;
}

.filter-chip-card.is-zero-count:not(.is-selected) {
  opacity: 0.42;
}

.filter-chip-card.is-zero-count:not(.is-selected):hover {
  opacity: 0.82;
}

.filter-chip-card.is-zero-count:not(.is-selected) .filter-chip-badge {
  color: var(--text-muted);
  opacity: 0.75;
}

.filter-empty-hint {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.filter-popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
  gap: 10px;
}

.filter-footer-info {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.filter-highlight-count {
  color: var(--primary);
  font-weight: 700;
}

.filter-footer-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-tabs {
  display: flex;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.filter-tab {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.filter-tab.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

.batch-actions-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  padding: 4px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.selection-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  padding-right: 4px;
}

/* Table Card */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.package-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.package-table th {
  background: var(--bg-subtle);
  padding: 8px 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.package-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.84rem;
  vertical-align: middle;
}

.package-table tbody tr {
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.package-table tbody tr:hover td {
  background-color: var(--bg-subtle);
}

.package-table tbody tr.row-selected td {
  background-color: var(--primary-light);
}

.package-table tbody tr.row-completed {
  opacity: 0.9;
}

.col-checkbox {
  width: 36px;
  text-align: center;
}

.col-info {
  min-width: 175px;
  width: 1px;
}

.col-status {
  min-width: 88px;
  text-align: center;
}

.col-stage {
  min-width: 80px;
  text-align: center;
}

.stage-header-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stage-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
}

.transit-tag {
  color: var(--s4-color);
  background: var(--s4-bg);
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

.au-tag {
  color: var(--s7-color);
}

.stage-name {
  font-size: 0.8125rem;
  font-weight: 700;
}

.in-transit-col {
  background: rgba(79, 70, 229, 0.03);
}

/* Tracking Info Cell */
.pkg-info-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pkg-tracking-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pkg-tracking-no {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  font-weight: 700;
}

.pkg-copy-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
}

.pkg-copy-btn:hover {
  color: var(--primary);
}

.pkg-note {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.pkg-note-tag {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  font-size: 0.75rem;
}

.pkg-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ==========================================================================
   三态流转按钮 (State 0: None, State 1: Checked, State 2: Crossed)
   ========================================================================== */
.stage-check-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.stage-tick-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle);
  background: var(--bg-surface);
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  user-select: none;
}

.stage-tick-btn:hover {
  transform: scale(1.1);
  border-color: var(--primary);
}

.stage-tick-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* 状态 1: 已打勾 (Checked) */
.stage-tick-btn.state-checked {
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.stage-tick-btn.s1-btn.state-checked {
  background: var(--s1-color);
  border-color: var(--s1-color);
}

.stage-tick-btn.s2-btn.state-checked {
  background: var(--s2-color);
  border-color: var(--s2-color);
}

.stage-tick-btn.s3-btn.state-checked {
  background: var(--s3-color);
  border-color: var(--s3-color);
}

.stage-tick-btn.s4-btn.state-checked {
  background: var(--s4-color);
  border-color: var(--s4-color);
}

.stage-tick-btn.s5-btn.state-checked {
  background: var(--s5-color);
  border-color: var(--s5-color);
}

.stage-tick-btn.s6-btn.state-checked {
  background: var(--s6-color);
  border-color: var(--s6-color);
}

.stage-tick-btn.s7-btn.state-checked {
  background: var(--s7-color);
  border-color: var(--s7-color);
}

/* 状态 2: 打叉跳过 (Crossed - 直发转运免经前置) */
.stage-tick-btn.state-crossed {
  background: var(--crossed-bg);
  border-color: var(--crossed-border);
  color: var(--crossed-color);
  box-shadow: none;
}

.stage-tick-btn.state-crossed svg {
  stroke-width: 2.5;
}

.stage-time-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-feature-settings: "tnum";
}

.label-crossed {
  color: var(--crossed-color);
  font-weight: 700;
}

/* Status Badge */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.badge-status.status-property {
  background: var(--s1-bg);
  color: var(--s1-color);
}

.badge-status.status-doorstep {
  background: var(--s2-bg);
  color: var(--s2-color);
}

.badge-status.status-indoor {
  background: var(--s3-bg);
  color: var(--s3-color);
}

.badge-status.status-tofwd {
  background: var(--s4-bg);
  color: var(--s4-color);
}

.badge-status.status-hub {
  background: var(--s5-bg);
  color: var(--s5-color);
}

.badge-status.status-toau {
  background: var(--s6-bg);
  color: var(--s6-color);
}

.badge-status.status-completed {
  background: var(--s7-bg);
  color: var(--s7-color);
}

.badge-status.status-pending {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* 快递单号最后4位纯数字重点强调 (轻量内嵌强调，与单号整体融为一体) */
.tracking-last4 {
  font-family: inherit;
  font-weight: 800;
  color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
  padding: 0 3px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  display: inline;
  border: none;
  text-decoration: none;
}

body[data-theme="dark"] .tracking-last4 {
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.22);
}

/* Action buttons */
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-icon-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon-action.btn-del:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 10px;
}

.file-path-hint {
  font-family: monospace;
  font-size: 0.75rem;
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--primary);
}

.table-footer-left,
.table-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-active {
  background: var(--s7-color);
}

.dot-crossed {
  background: var(--crossed-color);
}

.dot-pending {
  background: var(--border-subtle);
}

/* Empty state */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-icon-wrap svg {
  width: 32px;
  height: 32px;
}

.empty-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.empty-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* Custom checkbox */
.custom-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-sm {
  max-width: 440px;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
  padding: 0 20px;
}

.modal-tab-btn {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-surface);
}

.tab-badge {
  font-size: 0.6875rem;
  background: var(--s7-color);
  color: #ffffff;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.modal-pane {
  padding: 20px 22px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-label {
  font-size: 0.84rem;
  font-weight: 600;
}

.required {
  color: var(--danger);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.875rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.form-textarea {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  line-height: 1.6;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.batch-preview-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.radio-cards-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  cursor: pointer;
}

.radio-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--primary);
}

.radio-card-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio-card-title {
  font-size: 0.84rem;
  font-weight: 600;
}

.radio-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.mono-code-display {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.9375rem;
  font-weight: 700;
}

/* Confirm modal */
.confirm-modal-card {
  max-width: 440px;
  padding: 22px;
  gap: 18px;
}

.confirm-modal-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.confirm-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--danger-light);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.confirm-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.confirm-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.confirm-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.confirm-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 250px;
  max-width: 380px;
}

.toast.toast-success {
  border-left: 4px solid var(--s7-color);
}

.toast.toast-info {
  border-left: 4px solid var(--primary);
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 14px 10px;
    gap: 14px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-card[data-stat="total"] {
    grid-column: span 2;
  }

  .flow-guide-bar {
    display: none;
  }

  /* 手机端分两行显示：第1行搜索排序筛选+批量操作，第2行状态选择 */
  .toolbar-container {
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .toolbar-action-left {
    order: 1;
    flex: 1;
    min-width: 0;
    gap: 6px;
  }

  .search-input-wrapper {
    width: 140px;
    min-width: 100px;
  }

  .toolbar-action-right {
    order: 2;
    margin-left: auto;
    gap: 6px;
  }

  .toolbar-status-container {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .toolbar-status-container .filter-tabs {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .toolbar-status-container .filter-tabs::-webkit-scrollbar {
    display: none;
  }
}

/* ==========================================================================
   全新“单号与备注”多行版式 (Strict Multi-line Package Info Format)
   ========================================================================== */
.pkg-info-cell {
  display: flex;
  align-items: flex-start;
  position: relative;
}

/* 核心信息卡片块：宽度由第1行（司+单号+复制）定义为标准宽度 */
.pkg-card-box {
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* 行 1: 快递公司 快递单号 复制按钮 */
.pkg-line-1 {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.25;
}

.pkg-courier-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #0284c7;
  background: rgba(14, 165, 233, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(14, 165, 233, 0.2);
  letter-spacing: 0.2px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.3;
}

body[data-theme="dark"] .pkg-courier-badge {
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(14, 165, 233, 0.3);
}

.pkg-courier-badge.no-courier {
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-color: var(--border-light);
  font-weight: 500;
}

.pkg-tracking-no {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}

.pkg-copy-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  line-height: 1;
}

.pkg-copy-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.pkg-copy-btn svg {
  width: 11px;
  height: 11px;
}

/* ==========================================================================
   行点击操作浮动面板 (Row Action Floating Popover)
   ========================================================================== */
.row-action-popover {
  position: fixed;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.4), 0 4px 10px -2px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center bottom;
  user-select: none;
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popover-tracking-info {
  display: flex;
  align-items: center;
  gap: 5px;
}

.popover-pkg-icon {
  font-size: 0.85rem;
}

.popover-tracking-no {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.popover-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.popover-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 12px;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
}

.popover-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  margin-left: 1px;
}

.popover-close-btn:hover {
  color: var(--text-primary);
}

tbody tr.row-active-popover td {
  background: var(--bg-hover) !important;
}

/* 行 2: 店铺名 (左) + 商品数 (右)，分开左右分布和第1行一样宽 */
.pkg-line-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.72rem;
  color: var(--text-secondary);
  box-sizing: border-box;
  line-height: 1.25;
}

.pkg-merchant-name {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 6px;
}

.merchant-text {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pkg-icon-store {
  color: var(--text-muted);
  flex-shrink: 0;
}

.pkg-item-count-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  padding: 0 4px;
  border-radius: 3px;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.35;
}

.pkg-item-count-chip.single {
  color: var(--text-muted);
  background: var(--bg-subtle);
  font-weight: 500;
}

.pkg-item-count-chip.multi {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

/* 行 3 ~ n+2: 商品1名称 图片1 ... 商品n名称 图片n，左右分开分布和第1行一样宽 */
.pkg-line-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  box-sizing: border-box;
}

.pkg-item-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.73rem;
  box-sizing: border-box;
  line-height: 1.25;
}

.pkg-item-title {
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 6px;
}

.item-bullet {
  color: var(--text-muted);
  margin-right: 3px;
  font-size: 0.75rem;
  font-weight: 700;
}

.item-num-dot {
  font-weight: 700;
  color: var(--primary);
  margin-right: 3px;
  font-size: 0.68rem;
}

/* 图片上传标识徽章 (有图 / 无图) */
.pkg-image-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.66rem;
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.25;
}

.pkg-image-badge.has-img {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-weight: 600;
}

.pkg-image-badge.has-img:hover {
  background: rgba(16, 185, 129, 0.2);
  transform: translateY(-1px);
}

.pkg-image-badge.has-img img {
  width: 11px;
  height: 11px;
  object-fit: cover;
  border-radius: 2px;
}

.pkg-image-badge.no-img {
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-weight: 500;
}

.pkg-image-badge.no-img:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: rgba(79, 70, 229, 0.3);
}

.pkg-image-badge.no-img svg {
  stroke: currentColor;
}

/* 编辑弹窗专属辅助样式 */
.edit-no-image-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  color: #94a3b8;
}

.edit-no-image-box .no-img-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
  opacity: 0.7;
}

.edit-no-image-box .no-img-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
}

.edit-no-image-box .no-img-sub {
  font-size: 0.75rem;
  margin-top: 4px;
  color: #94a3b8;
}

.edit-image-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #1e293b;
  border-top: 1px solid #334155;
  flex-shrink: 0;
}

.edit-img-tip {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-left: auto;
}

.input-with-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
}

/* ==========================================================================
   编辑弹窗多商品切换与管理列表 (Multi-item Switcher in Edit Modal)
   ========================================================================== */
.edit-items-manager {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-items-mgr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.edit-items-mgr-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.badge-item-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.edit-items-scroll-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 125px;
  overflow-y: auto;
  padding-right: 2px;
}

.edit-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.edit-item-card:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}

.edit-item-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.edit-item-card-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.edit-item-radio {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.edit-item-card.active .edit-item-radio {
  color: var(--primary);
  font-weight: 700;
}

.edit-item-card-name {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-item-card-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.edit-item-thumb-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}

.edit-item-thumb-tag.has {
  color: #059669;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-weight: 600;
}

.edit-item-thumb-tag.empty {
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
}

.btn-del-edit-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.8rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-del-edit-item:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

/* 识图查重选择卡片样式 */
.dup-choices-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(245, 158, 11, 0.3);
}

.dup-choice-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--s1-color);
}

.dup-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dup-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dup-radio-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dup-radio-card input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--primary);
}

.dup-radio-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dup-radio-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dup-radio-desc {
  font-size: 0.725rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* 弹窗内的商品清单 */
.item-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 4px;
}

.modal-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.modal-item-row:hover {
  background: var(--bg-hover);
}

.modal-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.modal-item-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--s5-color);
  background: var(--s5-bg);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-item-name-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
  width: 100%;
}

.modal-item-name-input:hover {
  border-color: var(--primary-light);
}

.modal-item-name-input:focus {
  background: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.modal-item-right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-item-icon-edit {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-item-icon-edit:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.modal-item-single-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  user-select: none;
}

.modal-item-del-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-item-del-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.add-item-subform {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-light);
}

.form-input-sm {
  padding: 6px 10px;
  font-size: 0.8125rem;
}

/* 极简到达时间与官网直达弹窗样式 */
.official-jump-box {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.official-jump-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.official-jump-name {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.official-jump-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.arrival-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

/* 物流轨迹标签芯片 (表格行内) */
.btn-logistics-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn-logistics-chip.chip-unqueried {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-color: var(--border-light);
}

.btn-logistics-chip.chip-unqueried:hover {
  background: var(--bg-hover);
  color: var(--primary);
  border-color: var(--primary-light);
}

.btn-logistics-chip.chip-delivered {
  background: var(--s7-bg);
  color: var(--s7-color);
  border-color: rgba(16, 185, 129, 0.25);
}

.btn-logistics-chip.chip-transit {
  background: var(--s4-bg);
  color: var(--s4-color);
  border-color: rgba(99, 102, 241, 0.25);
}

.btn-logistics-chip .chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: currentColor;
}

.btn-logistics-chip .chip-arrow {
  font-size: 0.65rem;
  opacity: 0.7;
}

/* 物流详情弹窗样式 */
.logistics-summary-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 12px;
}

.summary-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.summary-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-bottom {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-light);
  font-size: 0.8125rem;
}

.summary-goods-label {
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.summary-goods-val {
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-all;
}

.logistics-actions-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.paste-trace-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.paste-trace-footer {
  display: flex;
  justify-content: flex-end;
}

/* 轨迹时间轴流水 */
.timeline-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.timeline-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.timeline-count {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.timeline-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: 8px;
}

.timeline-item {
  position: relative;
  padding-left: 20px;
  padding-bottom: 14px;
  border-left: 2px solid var(--border-light);
}

.timeline-item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -6px;
  top: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-subtle);
  border: 2px solid var(--bg-card);
}

.timeline-item.item-latest .timeline-dot {
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.timeline-item.item-delivered .timeline-dot {
  background: var(--s7-color);
  box-shadow: 0 0 0 3px var(--s7-bg);
}

.timeline-time {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 2px;
  font-feature-settings: "tnum";
}

.timeline-item.item-latest .timeline-time {
  color: var(--primary);
}

.timeline-context {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-primary);
  word-break: break-word;
}

.timeline-empty-hint {
  text-align: center;
  padding: 24px 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ==========================================================================
   智能识图与图片比对模块样式 (OCR & Image Comparison Styles)
   ========================================================================== */

.modal-md {
  max-width: 640px;
}

.modal-lg {
  max-width: 820px;
}

/* 拖拽上传区 */
.ocr-dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ocr-dropzone:hover,
.ocr-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.ocr-dropzone-sm {
  padding: 16px 12px;
  border-radius: var(--radius-md);
}

.ocr-drop-icon {
  color: var(--primary);
  opacity: 0.85;
}

.ocr-drop-text {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.ocr-drop-sub {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 520px;
}

.kbd-pill {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.725rem;
  font-family: monospace;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* 进度条 */
.ocr-progress-wrap {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.ocr-progress-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ocr-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ocr-progress-text {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--primary);
}

.ocr-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.ocr-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--s6-color));
  transition: width 0.3s ease;
}

/* 智能识图录入与逐张核对模态框 (OCR Stepper Modal) */
.modal-card.ocr-stepper-modal,
.ocr-stepper-modal {
  width: 95vw;
  max-width: 1180px;
  height: 90vh;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-card.ocr-stepper-modal .modal-header {
  flex-shrink: 0;
}

.ocr-modal-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 14px 20px;
  gap: 12px;
}

/* 缩略图切换列 — 样式已移到 .ocr-stepper-section 下方覆盖定义 */
.ocr-thumb-strip-wrap-placeholder { display: none; }

.strip-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ocr-thumb-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  padding: 3px 0;
  scrollbar-width: thin;
}

.ocr-thumb-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 5px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  user-select: none;
  width: 100%;
}

.ocr-thumb-pill:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.ocr-thumb-pill.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.ocr-thumb-pill img {
  width: 56px;
  height: 75px; /* 约 2:3 纵向 */
  object-fit: cover;
  object-position: top;
  background: #111827;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  display: block;
}

.ocr-thumb-pill-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  width: 100%;
}

.ocr-thumb-pill-title {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.ocr-thumb-pill-status {
  font-size: 0.6rem;
  font-weight: 600;
  text-align: center;
}

.ocr-thumb-pill-status.status-dup {
  color: var(--s1-color);
}

.ocr-thumb-pill-status.status-new {
  color: var(--s7-color);
}

/* 双栏核对主体 — 左侧缩略图列 + 右侧 [图片预览 | 表单] */
.ocr-stepper-section {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  height: 100%;
  gap: 10px;
  overflow: hidden;
}

/* 左侧纵向缩略图列 */
.ocr-thumb-strip-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  flex-shrink: 0;
  width: 90px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.ocr-thumb-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* 右侧双栏：图片查看器 + 表单 */
.ocr-review-grid {
  display: grid;
  grid-template-columns: minmax(200px, 0.65fr) 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

@media (max-width: 860px) {
  .ocr-review-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .ocr-thumb-strip-wrap {
    flex-direction: row;
    width: 100%;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .ocr-thumb-strip {
    flex-direction: row;
  }
}

/* 左栏：高清原图交互查看器 */
.ocr-viewer-panel {
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
  height: 100%;
  min-height: 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.ocr-viewer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  color: #f8fafc;
  flex-shrink: 0;
}

.viewer-img-title {
  font-size: 0.775rem;
  font-weight: 600;
  color: #94a3b8;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-tools-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-viewer-tool {
  background: #334155;
  border: 1px solid #475569;
  color: #e2e8f0;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-viewer-tool:hover {
  background: #475569;
  color: #fff;
  border-color: #64748b;
}

.btn-viewer-tool.btn-viewer-upload {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
  font-weight: 500;
}
.btn-viewer-tool.btn-viewer-upload:hover {
  background: rgba(59, 130, 246, 0.35);
  border-color: #3b82f6;
  color: #93c5fd;
}
.btn-viewer-tool.btn-viewer-del {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-viewer-tool.btn-viewer-del:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
}
.detail-viewport-edit-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  cursor: pointer;
  opacity: 0.88;
  transition: opacity 0.2s, transform 0.2s;
}
.detail-viewport-edit-overlay:hover {
  opacity: 1;
  transform: scale(1.05);
}
.detail-overlay-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.detail-overlay-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #3b82f6;
  color: #60a5fa;
}
.detail-edit-mode-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin-left: 6px;
}
.btn-detail-upload-mini {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: var(--text-muted, #94a3b8);
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-detail-upload-mini:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #60a5fa;
}

#ocrFitBtn {
  min-width: 52px;
  text-align: center;
  transition: all 0.18s ease;
}

#ocrFitBtn.active-fit-width {
  background: #1d4ed8;
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}

#ocrFitBtn.active-fit-height {
  background: #0f766e;
  border-color: #14b8a6;
  color: #ffffff;
  box-shadow: 0 0 6px rgba(20, 184, 166, 0.4);
}

.viewer-zoom-level {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-family: monospace;
  min-width: 44px;
  text-align: center;
}

.ocr-image-viewport {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
  cursor: grab;
  user-select: none;
}

.ocr-image-viewport.is-dragging {
  cursor: grabbing;
}

.ocr-image-viewport.is-dragging img {
  transition: none !important;
}

.ocr-image-viewport img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.ocr-viewport-hint {
  padding: 6px 12px;
  background: #1e293b;
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
  border-top: 1px solid #334155;
  flex-shrink: 0;
}

/* 右栏：结构化信息表单 */
.ocr-form-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 4px 8px 4px 2px;
  scrollbar-width: thin;
}

.ocr-form-status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.ocr-stepper-counter {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* 重复单号提示与选择卡片 */
.ocr-duplicate-box {
  background: var(--s1-bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dup-box-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.dup-alert-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.dup-alert-title {
  font-size: 0.8125rem;
  color: var(--s1-color);
}

.dup-existing-desc {
  font-size: 0.775rem;
  color: var(--text-primary);
  margin-top: 2px;
  line-height: 1.4;
}

.dup-choices-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(245, 158, 11, 0.3);
}

.dup-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.785rem;
  color: var(--text-primary);
  cursor: pointer;
}

.ocr-form-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 弹窗底部导航栏 */
.ocr-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.footer-left-actions,
.footer-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-center-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ocr-stepper-pill {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 4px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

/* 包裹信息概览卡片 (单图比对用) */
.pkg-current-summary {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.summary-line {
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.summary-line .label {
  color: var(--text-muted);
  margin-right: 4px;
}

.mono-text {
  font-family: monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* 比对面板布局 */
.attach-compare-section {
  margin-top: 14px;
  border-top: 1px solid var(--border-light);
  padding-top: 14px;
}

.compare-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
}

@media (max-width: 680px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
}

.compare-preview-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.compare-img-wrap {
  width: 100%;
  height: 200px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.compare-img-wrap img:hover {
  transform: scale(1.03);
}

.compare-img-hint {
  font-size: 0.725rem;
  color: var(--text-muted);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.compare-table th,
.compare-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}

.compare-table th {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  font-weight: 600;
}

.compare-old-val {
  color: var(--text-secondary);
}

.compare-new-val {
  color: var(--primary);
  font-weight: 600;
}

.diff-matched {
  color: var(--s7-color);
  font-size: 0.725rem;
}

.diff-mismatched {
  color: var(--s1-color);
  font-size: 0.725rem;
}

.compare-item-action-box {
  margin-top: 12px;
  padding: 10px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.radio-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-pill-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.785rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
}

/* 表格内微型徽章 */
.pkg-merchant-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.725rem;
  color: var(--s3-color);
  background: var(--s3-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.pkg-courier-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.725rem;
  color: var(--s5-color);
  background: var(--s5-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.pkg-image-preview-thumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.725rem;
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.pkg-image-preview-thumb:hover {
  opacity: 0.85;
}

.pkg-image-preview-thumb img {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
}

/* API Key 状态 Badge */
.api-key-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.api-status-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.api-status-badge.status-ready {
  background: var(--s7-bg);
  color: var(--s7-color);
}

.api-status-badge.status-missing {
  background: var(--s1-bg);
  color: var(--s1-color);
}

/* 全屏高清原图交互查看器 (Interactive Fullscreen Lightbox) */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 18, 0.94);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  z-index: 10000;
  user-select: none;
}

.lightbox-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(15, 23, 42, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  z-index: 10;
  flex-shrink: 0;
}

.lightbox-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #f1f5f9;
}

.lightbox-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-lightbox-tool {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-lightbox-tool:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
}

.lightbox-zoom-text {
  font-size: 0.8125rem;
  font-family: monospace;
  color: #94a3b8;
  min-width: 48px;
  text-align: center;
}

.btn-lightbox-close {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
  border-radius: 6px;
  font-size: 1.35rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
  margin-left: 6px;
}

.btn-lightbox-close:hover {
  background: rgba(239, 68, 68, 0.5);
  color: #ffffff;
}

.lightbox-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.lightbox-viewport.is-dragging {
  cursor: grabbing;
}

.lightbox-viewport img {
  max-width: 92vw;
  max-height: 84vh;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.05s linear;
  pointer-events: none;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8));
}

.lightbox-footer-hint {
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 0.725rem;
  color: rgba(255, 255, 255, 0.6);
  z-index: 10;
  flex-shrink: 0;
}

/* ============================================================
   T6: 包裹详情侧滑面板
   ============================================================ */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.pkg-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 1199;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  display: none;
}

.pkg-detail-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 320px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  box-shadow: -4px 0 28px rgba(0, 0, 0, 0.14);
  z-index: 1200;
  display: none;
  flex-direction: column;
  animation: slideInRight 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.pkg-detail-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.pkg-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  gap: 8px;
}

.pkg-detail-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pkg-detail-nav-counter {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 48px;
  text-align: center;
}

.btn-detail-nav {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm, 6px);
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1;
  transition: all 0.15s;
}
.btn-detail-nav:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.btn-detail-nav:disabled { opacity: 0.3; cursor: not-allowed; }

.pkg-detail-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.pkg-detail-close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px 7px;
  border-radius: 5px;
  transition: all 0.15s;
  line-height: 1;
}
.pkg-detail-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.pkg-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pkg-detail-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}
.pkg-detail-footer .btn {
  flex: 1;
  font-size: 0.8125rem;
  padding: 8px 10px;
}

/* 面板内容区块 */
.detail-header-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-courier-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #0284c7;
  background: rgba(14, 165, 233, 0.1);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(14, 165, 233, 0.22);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-tracking-no {
  font-size: 0.875rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--text-primary);
  word-break: break-all;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.detail-meta-label { color: var(--text-muted); }
.detail-meta-value { color: var(--text-secondary); font-weight: 500; }
.detail-meta-sep   { color: var(--border-subtle); margin: 0 2px; }

/* 流转阶段小格子 */
.detail-stages-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.detail-stage-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 3px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  transition: all 0.15s;
}

.detail-stage-item.detail-stage-checked {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.25);
}

.detail-stage-item.detail-stage-crossed {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--border-light);
  opacity: 0.65;
}

.detail-stage-name {
  font-size: 0.625rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
}

.detail-stage-time {
  font-size: 0.625rem;
  color: var(--text-secondary);
  text-align: center;
}

.detail-stage-checked .detail-stage-time { color: #059669; font-weight: 600; }
.detail-stage-crossed .detail-stage-time { color: var(--text-muted); }

/* 商品列表 */
.detail-items-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.detail-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border-radius: 7px;
  border: 1px solid var(--border-light);
  gap: 8px;
}

.detail-item-info {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.detail-item-index {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-item-name {
  font-size: 0.8125rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-item-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.detail-item-thumb {
  width: 32px;
  height: 42px;
  object-fit: cover;
  object-position: top;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border-light);
  transition: opacity 0.15s;
}
.detail-item-thumb:hover { opacity: 0.8; }

.detail-no-img {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 2px;
}

.btn-detail-del-item {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger-light, #fee2e2);
  color: var(--danger, #ef4444);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
}
.btn-detail-del-item:hover { background: var(--danger, #ef4444); color: #fff; }

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

#customConfirmModal {
  z-index: 99999 !important;
}

.detail-modal-header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 12px;
}

.detail-modal-counter-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 44px;
  text-align: center;
}

.detail-view-group {
  margin-bottom: 12px;
}

.detail-view-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-view-value {
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 500;
}

.detail-view-tracking {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.2;
}

.detail-copy-btn:hover {
  color: var(--primary);
  background: var(--bg-hover);
  border-color: var(--primary);
}

.detail-copy-btn svg {
  stroke: currentColor;
}

.detail-item-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  gap: 8px;
  transition: all var(--transition-fast);
}

.detail-item-card-row.is-single {
  cursor: default;
}

.detail-item-card-row.is-selectable {
  cursor: pointer;
}

.detail-item-card-row.is-selectable:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.detail-item-card-row.is-active-item {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.35);
  border-left: 3px solid var(--primary);
  box-shadow: none;
}

.detail-item-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.detail-item-badge-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-light, #eff6ff);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.detail-item-card-row.is-active-item .detail-item-badge-idx {
  background: var(--primary);
  color: #ffffff;
}

.detail-item-active-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* 7 选 1 状态选择器 */
.detail-status-radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.detail-status-radio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  user-select: none;
}

.detail-status-radio-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.detail-status-radio-card.is-selected {
  background: rgba(99, 102, 241, 0.16);
  border-color: var(--primary);
  box-shadow: 0 0 0 1.5px var(--primary);
}

.detail-status-radio-card input {
  display: none;
}

.detail-status-radio-num {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  margin-bottom: 3px;
}

.detail-status-radio-card.is-selected .detail-status-radio-num {
  color: var(--primary);
}

.detail-status-radio-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.detail-status-radio-card.is-selected .detail-status-radio-text {
  color: var(--primary);
}

/* 详情核对模态框：在位编辑模式控件 (In-place Inline Edit Controls) */
.detail-inline-box-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle, #334155);
  border-radius: var(--radius-sm, 6px);
  padding: 3px 8px;
  position: relative;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.detail-inline-box-wrap:focus-within,
.detail-inline-box-wrap:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light, rgba(99, 102, 241, 0.2));
}

/* 只读浏览态：边框透明、背景透明、无发光、文字位置与编辑态 100% 像素级对齐 */
.detail-inline-box-wrap.is-readonly {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: default !important;
}

.detail-inline-box-wrap.is-readonly:focus-within,
.detail-inline-box-wrap.is-readonly:hover {
  border-color: transparent !important;
  box-shadow: none !important;
}

.detail-inline-box-wrap.is-readonly .detail-inline-input,
.detail-inline-box-wrap.is-readonly .detail-inline-select {
  cursor: default !important;
  background: transparent !important;
  user-select: text;
}

.detail-inline-box-wrap.is-readonly .detail-inline-select {
  pointer-events: none !important;
  color: var(--text-main, #f8fafc) !important;
  opacity: 1 !important;
}

.detail-inline-box-wrap.is-readonly .detail-inline-select option {
  color: var(--text-main);
}

.detail-inline-box-wrap.is-readonly .detail-inline-icon,
.detail-inline-box-wrap.is-readonly .detail-chevron-icon,
.detail-inline-icon.is-hidden {
  visibility: hidden !important;
  pointer-events: none !important;
}

.detail-inline-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main, #f8fafc);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  width: 100%;
  min-width: 0;
  padding: 0;
  line-height: 1.35;
}

.detail-inline-input::placeholder {
  color: var(--text-muted);
  opacity: 0.55;
}

.detail-inline-select {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main, #f8fafc);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  width: 100%;
  padding-right: 18px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  line-height: 1.35;
}

.detail-inline-select option {
  background: var(--bg-surface);
  color: var(--text-main);
}

.detail-inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
  margin-left: 4px;
  opacity: 0.75;
}

.detail-inline-box-wrap:focus-within .detail-inline-icon,
.detail-inline-box-wrap:hover .detail-inline-icon {
  color: var(--primary);
  opacity: 1;
}

.detail-chevron-icon {
  position: absolute;
  right: 6px;
  margin-left: 0;
}

/* 1. 快递单号编辑框 */
.detail-tracking-box-wrap {
  width: 220px;
  max-width: 100%;
  padding: 2px 8px;
}

.detail-tracking-box-wrap .detail-inline-input {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
}

/* 2 & 5. 快递公司与商家编辑框 */
.detail-select-box-wrap,
.detail-input-box-wrap {
  width: 100%;
  max-width: 230px;
  padding: 4px 8px;
}

/* 3. 当前状态下拉选择框 */
.detail-status-select-wrap {
  width: 120px;
  flex-shrink: 0;
  padding: 3px 8px;
}

.detail-status-select-wrap .detail-inline-select {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* 4. 到达时间编辑框 */
.detail-time-box-wrap {
  width: 180px;
  max-width: 100%;
  padding: 3px 8px;
}

.detail-time-box-wrap .detail-inline-input {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

/* 6. 商品名编辑框 */
.detail-item-name-box-wrap {
  flex: 1;
  min-width: 0;
  padding: 2px 8px;
  background: var(--bg-card);
}

.detail-item-name-box-wrap .detail-inline-input {
  font-size: 0.88rem;
  font-weight: 500;
}

/* 8. 详情弹窗左下角删除包裹按钮 (适配深色与浅色配色) */
#pkgDetailDeleteBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: #dc2626;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

#pkgDetailDeleteBtn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

body[data-theme="dark"] #pkgDetailDeleteBtn {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

body[data-theme="dark"] #pkgDetailDeleteBtn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.text-danger {
  color: var(--danger, #ef4444) !important;
}
body[data-theme="dark"] .text-danger {
  color: #f87171 !important;
}