/* ==============================================================================
 * Tiamo Document Matrix Manager (DocumentMgr)
 * Linear / Apple Modern Engineering Aesthetic Design System
 * 严格遵照 Documents/UI_STYLE_GUIDE.md 规范：零 Emoji，纯净矢量，毛玻璃景深
 * ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

/* --- 设计令牌与主题变量 --- */
:root {
  /* 品牌色阶 (Primary Indigo) */
  --brand-primary: #4f46e5;
  --brand-primary-hover: #4338ca;
  --brand-primary-light: #eef2ff;
  --brand-primary-glow: rgba(79, 70, 229, 0.22);

  /* 基础中性灰阶 (Slate Palette) - 浅色模式 */
  --bg-base: #f8fafc;
  --bg-subtle: #f1f5f9;
  --surface-card: #ffffff;
  --surface-card-subtle: #fafbfd;
  --surface-glass: rgba(255, 255, 255, 0.88);
  --border-color: #e2e8f0;
  --border-subtle: rgba(226, 232, 240, 0.85);

  /* 文字系统 */
  --text-main: #0f172a;
  --text-regular: #334155;
  --text-muted: #64748b;
  --text-disabled: #94a3b8;

  /* 状态功能色 */
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-success-border: #a7f3d0;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #fde68a;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-danger-border: #fecaca;
  --color-info: #0284c7;
  --color-info-bg: #f0f9ff;
  --color-info-border: #bae6fd;

  /* 矩阵网格尺寸 */
  --cell-min-width: 200px;
  --cell-height: 128px;
  --y-axis-width: 220px;

  /* 阴影层级 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 0 3px var(--brand-primary-glow);
}

/* 深色模式变量 */
[data-theme="dark"] {
  --bg-base: #090d16;
  --bg-subtle: #0f172a;
  --surface-card: #131b2e;
  --surface-card-subtle: #182238;
  --surface-glass: rgba(19, 27, 46, 0.88);
  --border-color: #1e293b;
  --border-subtle: rgba(30, 41, 59, 0.85);

  --text-main: #f8fafc;
  --text-regular: #cbd5e1;
  --text-muted: #94a3b8;
  --text-disabled: #64748b;

  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-success-border: rgba(16, 185, 129, 0.3);
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-warning-border: rgba(245, 158, 11, 0.3);
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-danger-border: rgba(239, 68, 68, 0.3);
  --color-info-bg: rgba(2, 132, 199, 0.12);
  --color-info-border: rgba(2, 132, 199, 0.3);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 20px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 25px 35px rgba(0, 0, 0, 0.6);
}

/* --- 全局重置与基础排版 --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-base);
  color: var(--text-regular);
  font-family: 'Plus Jakarta Sans', 'Noto Sans SC', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 胶囊细滚动条 (规范 4.3) */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #334155;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* --- 布局容器 --- */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* --- 顶部 Header --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

[data-theme="dark"] .brand-tag {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Header 操作区 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 磁盘实时落盘状态指示器 */
.disk-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: 8px;
}

.disk-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}

/* --- 统一按钮系统 (规范 5.2) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  text-decoration: none;
}

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

.btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}
.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
}

.btn-secondary {
  background: var(--surface-card);
  border-color: var(--border-color);
  color: var(--text-regular);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--text-disabled);
  color: var(--text-main);
}

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

.btn-icon-only {
  padding: 8px;
  border-radius: 8px;
}

/* --- 统计概览条 (Stats Bar) --- */
.stats-banner {
  padding: 12px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-color);
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrap.indigo { background: rgba(79, 70, 229, 0.12); color: var(--brand-primary); }
.stat-icon-wrap.emerald { background: rgba(16, 185, 129, 0.12); color: var(--color-success); }
.stat-icon-wrap.sky { background: rgba(2, 132, 199, 0.12); color: var(--color-info); }
.stat-icon-wrap.amber { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-progress-bar {
  margin-top: 4px;
  width: 100%;
  height: 4px;
  border-radius: 9999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.stat-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--color-success));
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* --- 搜索与过滤工具栏 (Pill Filter Toolbar) --- */
.filter-toolbar {
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  min-width: 260px;
  flex: 1;
  max-width: 360px;
}

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

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 32px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-base);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-glow);
  background: var(--surface-card);
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-regular);
  border: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  transition: all 0.18s;
}

.filter-pill:hover {
  background: var(--border-color);
}

.filter-pill.active {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border-color: rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] .filter-pill.active {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  border-color: rgba(79, 70, 229, 0.4);
}

/* --- 核心矩阵视口与表格 (Document Matrix) --- */
.matrix-workspace {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--bg-base);
  padding: 16px 24px 48px;
}

.matrix-table-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: inline-block;
  min-width: 100%;
}

.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

/* 左上角绝对交点 (Top-Left Anchor) */
.matrix-cell-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 35;
  background: var(--surface-card);
  border-bottom: 2px solid var(--border-color);
  border-right: 2px solid var(--border-color);
  padding: 12px 16px;
  width: var(--y-axis-width);
  min-width: var(--y-axis-width);
  height: 58px;
}

.corner-label-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* 顶部横轴 (X-Axis: 人员列头) */
.matrix-th-person {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--surface-card);
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  padding: 10px 14px;
  min-width: var(--cell-min-width);
  max-width: 240px;
  vertical-align: middle;
  text-align: left;
}

.person-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.person-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.person-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

[data-theme="dark"] .person-avatar {
  background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
  color: #c7d2fe;
}

.person-meta {
  display: flex;
  flex-direction: column;
}

.person-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.person-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.person-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.7;
  transition: opacity 0.18s;
}

.matrix-th-person:hover .person-actions {
  opacity: 1;
}

.col-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

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

/* 左侧纵轴 (Y-Axis: 证件行头) */
.matrix-td-doctype {
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--surface-card);
  border-right: 2px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  width: var(--y-axis-width);
  min-width: var(--y-axis-width);
  vertical-align: middle;
}

.doctype-row-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.doctype-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doctype-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
  flex-shrink: 0;
}

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

.doctype-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.doctype-desc {
  font-size: 10px;
  color: var(--text-muted);
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 单元格 (Matrix Cells: person × docType) */
.matrix-cell {
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 8px;
  height: var(--cell-height);
  min-width: var(--cell-min-width);
  max-width: 240px;
  vertical-align: top;
  position: relative;
  background: var(--surface-card);
  transition: background-color 0.18s;
}

.matrix-cell:hover {
  background: var(--surface-card-subtle);
}

/* 单元格高亮态（拖拽悬停时） */
.matrix-cell.dragover {
  background: var(--brand-primary-light) !important;
  outline: 2px dashed var(--brand-primary);
  outline-offset: -3px;
}

[data-theme="dark"] .matrix-cell.dragover {
  background: rgba(79, 70, 229, 0.25) !important;
}

/* 缺漏高亮 */
.matrix-cell.is-missing {
  background: rgba(245, 158, 11, 0.04);
}

/* 单元格空态 (Empty Cell) */
.cell-empty-state {
  width: 100%;
  height: 100%;
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-disabled);
  cursor: pointer;
  transition: all 0.18s;
  background: transparent;
}

.cell-empty-state:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--bg-subtle);
}

.cell-empty-icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.cell-empty-text {
  font-size: 11px;
  font-weight: 600;
}

/* 单元格有图态 (Cell with Images) */
.cell-content-filled {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}

.cell-thumbs-grid {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
  height: 72px;
  overflow: hidden;
}

.cell-thumb-wrapper {
  position: relative;
  height: 100%;
  flex: 1;
  max-width: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s;
}

.cell-thumb-wrapper:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
  z-index: 5;
}

.cell-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cell-thumb-more {
  flex: 1;
  max-width: 48px;
  height: 100%;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.cell-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

.cell-badge-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

.cell-tags-preview {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

.cell-quick-add-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
}

.matrix-cell:hover .cell-quick-add-btn {
  opacity: 1;
}

.cell-quick-add-btn:hover {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

/* --- 全屏多图画廊与全能预览弹窗 (Lightbox Viewer Modal) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s, visibility 0.22s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-dialog {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 95vw;
  max-width: 1280px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: modalScaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface-card);
}

.lightbox-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lightbox-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.lightbox-meta-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}

[data-theme="dark"] .lightbox-meta-badge {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
}

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

/* 核心舞台与侧边栏 */
.lightbox-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-subtle);
}

/* 图像舞台 (Hero Stage) */
.lightbox-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #09090b; /* 规范 4.2 纯黑对比工作区 */
  user-select: none;
}

.stage-img-container {
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.stage-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  border-radius: 6px;
}

/* 舞台内悬浮浮动工具条 (Floating Pill Toolbar) */
.stage-floating-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(24, 24, 27, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.stage-tool-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #e4e4e7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.stage-tool-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.stage-tool-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 4px;
}

/* 翻页按键 */
.stage-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(24, 24, 27, 0.65);
  backdrop-filter: blur(12px);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  z-index: 10;
}

.stage-nav-btn:hover {
  background: rgba(24, 24, 27, 0.9);
  transform: translateY(-50%) scale(1.08);
}

.stage-nav-prev { left: 20px; }
.stage-nav-next { right: 20px; }

/* 侧边属性与编辑抽屉 (Metadata Drawer) */
.lightbox-sidebar {
  width: 340px;
  background: var(--surface-card);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
  gap: 20px;
}

.sidebar-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

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

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-base);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-glow);
  background: var(--surface-card);
}

.tag-preset-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.tag-preset-chip {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-regular);
  cursor: pointer;
  transition: all 0.15s;
}

.tag-preset-chip:hover {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
  border-color: rgba(79, 70, 229, 0.3);
}

.meta-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  background: var(--bg-base);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-item-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.meta-item-value {
  font-size: 12px;
  color: var(--text-main);
  font-weight: 600;
}

/* 底部缩略图底片胶囊栏 (Filmstrip Bar) */
.lightbox-filmstrip {
  padding: 10px 20px;
  background: var(--surface-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
}

.filmstrip-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--bg-subtle);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  position: relative;
}

.filmstrip-thumb:hover {
  transform: translateY(-2px);
  border-color: var(--text-disabled);
}

.filmstrip-thumb.active {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-primary-glow);
}

.filmstrip-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.filmstrip-add-btn {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  border: 2px dashed var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.filmstrip-add-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-light);
}

/* --- 常规管理类模态框 (新增/重命名人员与证件) --- */
.standard-modal-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  width: 90vw;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-subtle);
}

/* 拖拽文件大区域 (Dropzone) */
.dropzone-box {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: var(--bg-base);
  transition: all 0.18s;
  text-align: center;
}

.dropzone-box:hover, .dropzone-box.dragover {
  border-color: var(--brand-primary);
  background: var(--brand-primary-light);
}

[data-theme="dark"] .dropzone-box:hover, [data-theme="dark"] .dropzone-box.dragover {
  background: rgba(79, 70, 229, 0.15);
}

/* 气泡轻提示 (Toast) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.2s, transform 0.2s;
}

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

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

/* --- 批量上传向导扩展与智能匹配样式 --- */
.upload-modal-card {
  max-width: 720px;
  width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.upload-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pending-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.pending-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.pending-file-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pending-file-item:hover {
  border-color: var(--brand-primary);
}

.pending-file-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pending-file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.pending-file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-file-size {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pending-file-controls {
  display: grid;
  grid-template-columns: 140px 140px 1fr auto;
  gap: 8px;
  align-items: center;
}

.smart-match-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.cell-thumb-pdf {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(239, 68, 68, 0.08);
  border-radius: 6px;
  color: #ef4444;
}

.cell-pdf-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.stage-pdf-frame {
  width: 80vw;
  max-width: 900px;
  height: 75vh;
  border: none;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

/* --- 响应式微调 --- */
@media (max-width: 900px) {
  .app-header {
    padding: 10px 16px;
  }
  .matrix-workspace {
    padding: 12px 16px 36px;
  }
  .lightbox-body {
    flex-direction: column;
  }
  .lightbox-sidebar {
    width: 100%;
    height: 240px;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
  .pending-file-controls {
    grid-template-columns: 1fr 1fr;
  }
}

