:root {
  --bs-primary: #1a73e8;
  --bs-primary-rgb: 26, 115, 232;
  --bs-link-color: #1a73e8;
  --bs-link-hover-color: #1557b0;
  --bs-border-radius: 10px;
  --bs-border-radius-sm: 8px;
  --bs-body-font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --bs-body-color: #1e293b;
  --bs-secondary-color: #64748b;
  --bs-border-color: #e2e8f0;
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-soft: #e8f0fe;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

body {
  margin: 0;
  font-family: var(--bs-body-font-family);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #dbeafe 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, #e0e7ff 0%, transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 100%;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.header {
  margin-bottom: 28px;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 28px;
  flex-wrap: nowrap;
}

.header-left {
  flex: 1 1 auto;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ocr-mode-group {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  margin: 6px 0 0;
  padding: 8px 14px;
  background: rgba(26, 115, 232, 0.06);
  border: 1px solid rgba(26, 115, 232, 0.15);
  border-radius: 10px;
}

.ocr-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.ocr-mode-option input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.ocr-mode-option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--text-muted);
}

.ocr-mode-option.is-disabled input {
  cursor: not-allowed;
}

.brand-mark {
  width: 14px;
  height: 36px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--primary) 0%, #3b82f6 100%);
  flex-shrink: 0;
}

.brand h1,
.brand .h3 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.subtitle,
.header .text-secondary {
  margin: 8px 0 0 26px !important;
  color: var(--text-muted) !important;
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .header-top {
    flex-wrap: wrap;
  }

  .ocr-mode-group {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Soft panels instead of flat Bootstrap cards */
.panel-card.card,
.list-card.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-card .card-body,
.list-card .card-body {
  padding: 24px;
}

.panel-upload-body {
  position: relative;
}

.template-sample-link {
  position: absolute;
  right: 25px;
  bottom: 45px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--primary);
  text-decoration: underline;
  line-height: 1.2;
  font-weight: 600;
}

.template-sample-link:hover {
  color: #1d4ed8;
}

.template-sample-link svg {
  flex-shrink: 0;
}

/* Upload */
.upload-zone {
  border: 2px dashed #93c5fd;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.upload-zone.has-file {
  border-style: solid;
  border-color: var(--primary);
}

.upload-icon {
  color: var(--primary);
}

#btnRecognize.btn {
  min-width: 240px;
  padding: 14px 40px;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  box-shadow: 0 8px 24px rgba(26, 115, 232, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

#btnRecognize.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(26, 115, 232, 0.45);
  background: linear-gradient(135deg, var(--primary-dark) 0%, #1d4ed8 100%);
}

#btnRecognize.btn:disabled {
  opacity: 0.45;
  box-shadow: none;
}

/* Buttons polish */
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  font-weight: 600;
}

.btn-warning {
  --bs-btn-color: #fff;
  --bs-btn-bg: #f59e0b;
  --bs-btn-border-color: #f59e0b;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #d97706;
  --bs-btn-hover-border-color: #d97706;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #b45309;
  --bs-btn-active-border-color: #b45309;
  --bs-btn-disabled-color: #fff;
  font-weight: 600;
}

.btn-outline-secondary {
  --bs-btn-color: var(--text);
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--primary-soft);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-hover-color: var(--primary);
  --bs-btn-active-bg: var(--primary-soft);
  --bs-btn-active-border-color: var(--primary);
  --bs-btn-active-color: var(--primary);
  background: #fff;
  font-weight: 600;
}

.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-soft);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-hover-color: var(--primary-dark);
  font-weight: 600;
}

.btn-outline-success {
  --bs-btn-color: #0d9f6e;
  --bs-btn-border-color: #0d9f6e;
  --bs-btn-hover-bg: #e6f7f1;
  --bs-btn-hover-border-color: #0d9f6e;
  --bs-btn-hover-color: #0a7a55;
  font-weight: 600;
}

.btn-group > .btn {
  border-radius: 8px !important;
}

.btn-group {
  gap: 8px;
}

.btn-group > .btn:not(:first-child) {
  margin-left: 0;
}

/* Badge */
.count-badge {
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.35em 0.7em;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  transition: box-shadow 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.count-badge:hover {
  opacity: 0.92;
}

.count-badge.is-active {
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.25);
  transform: translateY(-1px);
}

.count-success {
  background: #e6f7f1 !important;
  color: #0d9f6e !important;
}

.count-success.is-active {
  background: #0d9f6e !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(13, 159, 110, 0.28);
}

.count-failed {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

.count-failed.is-active {
  background: #dc2626 !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.28);
}

.count-all {
  background: #e8f0fe !important;
  color: #1a73e8 !important;
}

.count-all.is-active {
  background: #1a73e8 !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.28);
}

.failed-tip {
  font-size: 0.78rem;
  font-weight: 400;
  color: #c62828;
  line-height: 1.35;
  max-width: 420px;
}

/* Soft status badges (override Bootstrap harsh colors) */
.badge.ocr-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35em 0.7em;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.ocr-status-cell {
  vertical-align: middle;
}

.ocr-error-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  cursor: help;
  flex-shrink: 0;
  user-select: none;
}

.ocr-error-tip-warn {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #f59e0b;
}

.ocr-error-tip-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #ef4444;
}

.btn-archive-failed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(13, 159, 110, 0.35);
  border-radius: 6px;
  background: #ecfdf5;
  color: #0d9f6e;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-archive-failed:hover {
  background: #d1fae5;
  color: #047857;
  border-color: #10b981;
}

.btn-archive-failed:focus-visible {
  outline: 2px solid #34d399;
  outline-offset: 1px;
}

.badge.rounded-pill.text-bg-secondary {
  background: #f1f5f9 !important;
  color: #64748b !important;
}

.badge.rounded-pill.text-bg-warning {
  background: #fff7ed !important;
  color: #d97706 !important;
}

.badge.rounded-pill.text-bg-success {
  background: #e6f7f1 !important;
  color: #0d9f6e !important;
}

.badge.rounded-pill.text-bg-danger {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

.badge.ocr-badge .spinner-border-sm {
  width: 0.75rem;
  height: 0.75rem;
  border-width: 0.15em;
}

/* Filter panel */
.filter-panel.card {
  background: #f8fafc !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px;
  box-shadow: none;
}

.filter-panel .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-control,
.form-select {
  border-color: var(--border);
  border-radius: 8px;
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.form-control-sm,
.form-select-sm {
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
}

/* Table */
.table-shell {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  max-height: calc(100vh - 320px);
  position: relative;
  background: #fff;
}

.table-shell.no-paging {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.page-size-select {
  width: auto;
  min-width: 88px;
}

#invoiceTable {
  min-width: 1600px;
  font-size: 0.85rem;
  margin-bottom: 0;
  border-collapse: separate !important;
  border-spacing: 0;
  --bs-table-hover-bg: #f1f5f9;
}

#invoiceTable > :not(caption) > * > * {
  /* 覆盖 Bootstrap 单元格背景，避免 sticky 穿透 */
  background-color: transparent;
}

#invoiceTable thead th {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  background-color: #f1f5f9 !important;
  /* 表头纵向吸顶 */
  position: sticky;
  top: 0;
  z-index: 3;
}

#invoiceTable td {
  padding: 10px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  background-color: #fff !important;
  white-space: nowrap !important;
  overflow: visible;
  text-overflow: clip;
  max-width: none;
}

/* 仅指定列：单行省略 + tooltip */
#invoiceTable td.cell-ellipsis {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

#invoiceTable td.cell-ellipsis .cell-tip {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#invoiceTable tbody tr:hover td {
  background-color: #f8fafc !important;
}

#invoiceTable tbody tr.is-selected td {
  background-color: #e8f0fe !important;
}

#invoiceTable tbody tr.is-selected:hover td {
  background-color: #dbe7fc !important;
}

/* 左右固定列：表头 + 表体同时横向吸住 */
#invoiceTable th.sticky-col-check,
#invoiceTable td.sticky-col-check {
  position: sticky !important;
  left: 0 !important;
  min-width: 40px;
  width: 40px;
  text-align: center;
  box-shadow: none;
  padding-left: 8px !important;
  padding-right: 8px !important;
}

#invoiceTable th.sticky-col-seq,
#invoiceTable td.sticky-col-seq {
  position: sticky !important;
  left: 40px !important;
  min-width: 72px;
  width: 72px;
  box-shadow: none;
}

#invoiceTable th.sticky-col-file,
#invoiceTable td.sticky-col-file {
  position: sticky !important;
  left: 112px !important;
  min-width: 100px;
  width: 100px;
  box-shadow: none;
}

#invoiceTable th.sticky-col-status,
#invoiceTable td.sticky-col-status {
  position: sticky !important;
  right: 168px !important;
  min-width: 118px;
  width: 118px;
  text-align: center;
  box-shadow: none;
}

#invoiceTable th.sticky-col-action,
#invoiceTable td.sticky-col-action {
  position: sticky !important;
  right: 0 !important;
  min-width: 168px;
  width: 168px;
  text-align: center;
  box-shadow: none;
}

#invoiceTable td.sticky-col-action .d-flex {
  justify-content: center;
}

/* 表体固定列背景 */
#invoiceTable td.sticky-col-check,
#invoiceTable td.sticky-col-seq,
#invoiceTable td.sticky-col-file,
#invoiceTable td.sticky-col-status,
#invoiceTable td.sticky-col-action {
  z-index: 2;
  background-color: #fff !important;
}

#invoiceTable tbody tr:hover td.sticky-col-check,
#invoiceTable tbody tr:hover td.sticky-col-seq,
#invoiceTable tbody tr:hover td.sticky-col-file,
#invoiceTable tbody tr:hover td.sticky-col-status,
#invoiceTable tbody tr:hover td.sticky-col-action {
  background-color: #f8fafc !important;
}

#invoiceTable tbody tr.is-selected td.sticky-col-check,
#invoiceTable tbody tr.is-selected td.sticky-col-seq,
#invoiceTable tbody tr.is-selected td.sticky-col-file,
#invoiceTable tbody tr.is-selected td.sticky-col-status,
#invoiceTable tbody tr.is-selected td.sticky-col-action {
  background-color: #e8f0fe !important;
}

#invoiceTable tbody tr.is-selected:hover td.sticky-col-check,
#invoiceTable tbody tr.is-selected:hover td.sticky-col-seq,
#invoiceTable tbody tr.is-selected:hover td.sticky-col-file,
#invoiceTable tbody tr.is-selected:hover td.sticky-col-status,
#invoiceTable tbody tr.is-selected:hover td.sticky-col-action {
  background-color: #dbe7fc !important;
}

/* 表头固定列：同时 top + left/right，层级最高，横向滚动时列名不跑偏 */
#invoiceTable thead th.sticky-col-check,
#invoiceTable thead th.sticky-col-seq,
#invoiceTable thead th.sticky-col-file,
#invoiceTable thead th.sticky-col-status,
#invoiceTable thead th.sticky-col-action {
  top: 0 !important;
  z-index: 5;
  background-color: #f1f5f9 !important;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  color: var(--primary) !important;
}

.sortable-th:hover {
  color: var(--primary-dark) !important;
}

.sort-icon {
  font-size: 0.75rem;
  margin-left: 2px;
  opacity: 0.85;
}

.file-link {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;
}

.file-link:hover {
  color: var(--primary-dark);
}

/* Pagination */
.pagination {
  gap: 2px;
}

.pagination .page-link {
  border-radius: 8px !important;
  margin: 0 4px;
  border-color: var(--border);
  color: var(--text);
  min-width: 36px;
  text-align: center;
}

.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pagination .page-item.active .page-link:hover,
.pagination .page-item.active .page-link:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.pagination .page-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.pagination .page-item.disabled .page-link {
  opacity: 0.45;
}

/* App dialog */
.app-dialog-content {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.16);
}

.app-dialog-message {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.overlay[hidden] {
  display: none !important;
}

#progressOverlay {
  z-index: 1200;
}

#previewModal {
  z-index: 1000;
}

#editModal {
  z-index: 1100;
}

.progress-card.card {
  min-width: 320px;
  max-width: 440px;
  width: 100%;
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.progress-card .progress {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-card .progress-bar {
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 999px;
}

#progressMessage {
  word-break: break-all;
}

/* Preview */
.preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 96vw;
  width: 100%;
}

.preview-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: auto;
  max-width: calc(96vw - 120px);
}

.preview-card {
  position: relative;
  width: fit-content;
  max-width: calc(96vw - 120px);
  max-height: calc(90vh - 72px);
  background: #0f172a;
  border-radius: 12px;
  padding: 12px 12px 44px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  flex-shrink: 0;
}

.preview-info-row {
  display: flex;
  gap: 10px 14px;
  min-width: 0;
}

.preview-info-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-info-grow {
  flex: 1 1 0;
}

.preview-info-k {
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.2;
}

.preview-info-v {
  font-size: 0.82rem;
  color: #f8fafc;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-viewport {
  width: auto;
  max-width: 100%;
  /* 只限制可视区域高度，超出可滚动；不要压图片宽度 */
  max-height: calc(90vh - 200px);
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  border-radius: 8px;
}

.preview-card img {
  width: 800px;
  max-width: min(800px, calc(96vw - 140px));
  height: auto;
  max-height: none;
  display: block;
  border-radius: 8px;
  object-fit: unset;
  user-select: none;
  -webkit-user-drag: none;
}

.preview-close.btn-close {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 2;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  background-image: none !important;
  border: 0;
  border-radius: 50%;
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.preview-close.btn-close::before {
  content: "×";
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  color: #0f172a;
  /* 抵消部分字体视觉偏下 */
  transform: translateY(-0.5px);
}

.preview-nav.btn {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  --bs-btn-padding-x: 0;
  --bs-btn-padding-y: 0;
  --bs-btn-line-height: 1;
  --bs-btn-font-size: 1rem;
}

.preview-nav-icon {
  display: block;
  flex-shrink: 0;
}

.preview-nav.btn:hover:not(:disabled) {
  background: #fff;
  transform: scale(1.06);
}

.preview-nav.btn:disabled {
  opacity: 0.35;
}

.preview-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  color: #e2e8f0;
  font-size: 0.85rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
  border-radius: 0 0 12px 12px;
}

.preview-meta #previewFileName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.preview-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.preview-archive-failed {
  border-color: rgba(226, 232, 240, 0.45);
  background: rgba(15, 23, 42, 0.45);
  color: #e2e8f0;
}

.preview-archive-failed:hover {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.65);
}

.preview-retry-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.8rem;
  color: #e2e8f0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.preview-retry-check input {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  cursor: pointer;
  accent-color: #60a5fa;
}

.preview-meta #previewIndex {
  flex-shrink: 0;
  color: #94a3b8;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.88);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.preview-toolbar .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.25);
  font-weight: 600;
}

.preview-toolbar .btn-primary {
  font-weight: 600;
}

/* Edit */
.edit-card.card {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: hidden;
  border: none;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.edit-card .card-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  background: #fff;
}

.edit-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.edit-card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
}

.edit-card-footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  border-radius: 0 0 16px 16px;
}

.list-title {
  font-size: 1.15rem;
  font-weight: 700;
}

/* 匹配记录可搜索下拉 */
.batch-picker {
  min-width: min(420px, 100%);
  max-width: 520px;
  flex: 1 1 280px;
}

.batch-combobox {
  position: relative;
  display: flex;
  align-items: stretch;
}

.batch-combobox .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 8px;
}

.batch-combobox-toggle {
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 var(--bs-border-radius-sm) var(--bs-border-radius-sm) 0;
  background: #f8fafc;
  color: var(--text-muted);
  padding: 0 10px;
  line-height: 1;
  cursor: pointer;
}

.batch-combobox-toggle:hover {
  background: #eef2f7;
  color: var(--text);
}

.batch-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.batch-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
}

.batch-option:hover,
.batch-option.is-active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.batch-option-empty {
  padding: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 640px) {
  .preview-stage {
    gap: 8px;
  }

  .preview-nav.btn {
    width: 40px;
    height: 40px;
  }

  .preview-nav-icon {
    width: 18px;
    height: 18px;
  }

  .preview-main {
    max-width: calc(96vw - 96px);
  }

  .preview-info-row {
    flex-wrap: wrap;
  }

  #btnRecognize.btn {
    width: 100%;
  }

  .batch-picker {
    min-width: 100%;
    max-width: 100%;
  }
}
