/* ============ 全局 ============ */

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

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
  padding: 20px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  padding: 28px 32px;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}

h1 {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 6px;
}

.subtitle {
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ============ 拖拽区 ============ */

.drop-zone {
  border: 2px dashed #9aa3ad;
  border-radius: 12px;
  padding: 36px 24px;
  text-align: center;
  background: #fafbfc;
  color: #555;
  cursor: pointer;
  margin: 16px 0 20px;
  transition: all .2s ease;
  position: relative;
}

.drop-zone:hover {
  border-color: #1677ff;
  background: #f0f7ff;
}

.drop-zone.drag-over {
  border-color: #1677ff;
  background: #e6f4ff;
  color: #1677ff;
  transform: scale(1.01);
}

.drop-zone .drop-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

.drop-zone p {
  margin: 6px 0;
  font-size: 15px;
}

.drop-hint {
  font-size: 13px;
  color: #9ca3af;
}

.drop-hint-sub {
  font-size: 12px;
  color: #b0b8c0;
  margin-top: 4px;
}

.drop-zone input[type="file"] {
  display: none;
}

/* ============ 按钮 ============ */

.btn-primary {
  background: #1677ff;
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}

.btn-primary:hover { background: #0e5fd9; }

.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}

.btn-secondary:hover {
  border-color: #1677ff;
  color: #1677ff;
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}

.btn-small:hover { border-color: #ef4444; color: #ef4444; }

/* ============ 设置栏 ============ */

.settings-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.hp-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.hp-url {
  flex: 1;
  min-width: 240px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
}

/* ============ 进度条 ============ */

.progress {
  background: #e6f4ff;
  border: 1px solid #91caff;
  color: #1677ff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress.hidden { display: none; }

.loading-spinner {
  width: 14px; height: 14px;
  border: 2px solid #91caff;
  border-top-color: #1677ff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
}

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

/* ============ 统计栏 ============ */

.stats-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
}

.stat-item { display: flex; align-items: center; gap: 4px; }

.stat-num {
  font-weight: 700;
  font-size: 15px;
}

.stat-invoice .stat-num  { color: #276749; }
.stat-train .stat-num    { color: #2b6cb0; }
.stat-contract .stat-num  { color: #6b21a8; }
.stat-error .stat-num    { color: #dc2626; }

/* ============ 表格 ============ */

.table-wrapper {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 700px;
}

thead th {
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

tbody tr:hover { background: #fafbfc; }

td .editable {
  color: #1677ff;
  cursor: pointer;
  text-decoration: underline dotted;
}

td .editable:hover { color: #0e5fd9; }

td .error { color: #ef4444; font-weight: 600; }

.type-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.type-invoice  { background: #d1fae5; color: #065f46; }
.type-train    { background: #dbeafe; color: #1e40af; }
.type-contract { background: #ede9fe; color: #5b21b6; }
.type-error    { background: #fee2e2; color: #991b1b; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}

.empty-state .empty-icon {
  font-size: 42px;
  display: block;
  margin-bottom: 10px;
}

/* ============ 操作按钮区 ============ */

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ============ 弹窗 ============ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden { display: none; }

.modal-content {
  background: #fff;
  padding: 28px;
  border-radius: 12px;
  width: 440px;
  max-width: 95%;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
}

.modal-content h3 {
  margin-bottom: 16px;
  font-size: 18px;
  color: #1a1a2e;
}

.modal-content label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}

.modal-content input {
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.modal-content input:focus {
  outline: none;
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22,119,255,.15);
}

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

.btn-cancel {
  padding: 8px 18px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-save {
  padding: 8px 18px;
  border: none;
  background: #1677ff;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn-save:hover { background: #0e5fd9; }

/* ============ Toast ============ */

.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  transition: opacity .3s;
}

.toast.hidden { display: none; }
