/* ── 全局重置 ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
  color: #333;
}

#app { min-height: 100vh; }

/* ── 顶部导航 ── */
.app-header {
  background: linear-gradient(135deg, #1a6fd8 0%, #0d47a1 100%);
  color: #fff;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.app-header .logo-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.25);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── 主体布局 ── */
.app-body {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* ── 侧边栏 ── */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.task-item {
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
  position: relative;
}

.task-item:hover { background: #f5f7fa; }

.task-item.active {
  background: #e8f0fe;
  border-left-color: #1a6fd8;
}

.task-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.task-item-name {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.task-item-delete {
  flex-shrink: 0;
  color: #ccc;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px;
  transition: color 0.15s, background 0.15s;
  visibility: hidden;
}

.task-item:hover .task-item-delete {
  visibility: visible;
}

.task-item-delete:hover {
  color: #d32f2f !important;
  background: rgba(211, 47, 47, 0.08);
}

.task-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.task-item-time {
  font-size: 11px;
  color: #999;
}

.task-empty {
  padding: 40px 20px;
  text-align: center;
  color: #bbb;
  font-size: 13px;
}

.task-empty-icon {
  margin-bottom: 8px;
}

/* ── 主内容区 ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  min-width: 0;
}

/* ── 上传区 ── */
.upload-zone {
  background: #fff;
  border-radius: 12px;
  padding: 36px 32px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  max-width: 700px;
  margin: 0 auto;
}

.upload-zone-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.upload-zone-subtitle {
  font-size: 14px;
  color: #888;
  margin-bottom: 28px;
}

.upload-drop-area {
  border: 2px dashed #c8d8f0;
  border-radius: 10px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8faff;
  position: relative;
}

.upload-drop-area:hover,
.upload-drop-area.drag-over {
  border-color: #1a6fd8;
  background: #eef3fd;
}

.upload-drop-icon {
  margin-bottom: 12px;
}

.upload-drop-text {
  font-size: 15px;
  color: #555;
  margin-bottom: 8px;
}

.upload-drop-hint {
  font-size: 12px;
  color: #aaa;
}

.upload-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #f0f7ff;
  border: 1px solid #c8d8f0;
  border-radius: 8px;
  margin-top: 16px;
}

.upload-file-icon { display: flex; align-items: center; }

.upload-file-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #1a6fd8;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-size { font-size: 12px; color: #999; }

.upload-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ── Excel 格式提示 ── */
.format-hint {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 20px;
  font-size: 13px;
  color: #7a5f00;
}

.format-hint-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.format-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.format-col-tag {
  background: #fff7cc;
  border: 1px solid #ffe066;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  color: #7a5f00;
}

/* ── 任务详情卡片 ── */
.task-detail {
  max-width: 900px;
}

.task-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

.task-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.task-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}

.progress-section {
  margin-bottom: 18px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-text {
  font-size: 14px;
  color: #555;
}

.progress-count {
  font-size: 14px;
  font-weight: 600;
  color: #1a6fd8;
}

/* ── 行状态表格 ── */
.row-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}

.row-table th {
  background: #f5f7fa;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 1px solid #e8e8e8;
}

.row-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.row-table tr:last-child td { border-bottom: none; }
.row-table tr:hover td { background: #fafbfc; }

/* ── 状态标签 ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge.pending   { background: #f5f5f5; color: #888; }
.status-badge.running   { background: #e6f0ff; color: #1a6fd8; }
.status-badge.done      { background: #e6f9f0; color: #1a8f5a; }
.status-badge.error     { background: #fff1f0; color: #d32f2f; }

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.running .status-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── 下载区 ── */
.download-section {
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
  border: 1px solid #a5d6a7;
  border-radius: 10px;
  padding: 24px 28px;
  text-align: center;
}

.download-icon { margin-bottom: 10px; }

.download-title {
  font-size: 18px;
  font-weight: 700;
  color: #1b5e20;
  margin-bottom: 6px;
}

.download-subtitle {
  font-size: 14px;
  color: #4caf50;
  margin-bottom: 20px;
}

/* ── 空状态 ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #bbb;
}

.empty-state-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.35; }
.empty-state-text { font-size: 16px; }
.empty-state-hint { font-size: 13px; margin-top: 8px; }

/* ── 响应式 ── */
@media (max-width: 768px) {
  .sidebar { width: 220px; }
  .main-content { padding: 16px; }
  .upload-zone, .task-card { padding: 16px; }
}

@media (max-width: 600px) {
  .app-body { flex-direction: column; }
  .sidebar  { width: 100%; height: auto; border-right: none; border-bottom: 1px solid #e8e8e8; }
  .sidebar-body { max-height: 200px; }
}

/* ── 隐藏文件 input ── */
input[type="file"].hidden-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
