:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --text-muted: #8b9cb3;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 10px;
  --font: "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.header {
  padding: 40px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 6px;
  font-size: 0.95rem;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.hint code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--primary);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  width: 100%;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
}

.config-card .btn-secondary {
  margin-right: 10px;
}

.status-badge {
  font-size: 0.8rem;
  vertical-align: middle;
}

.status-badge.ok { color: var(--success); }
.status-badge.err { color: var(--error); }
.status-badge.pending { color: var(--warning); }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.06);
}

.dropzone-content {
  pointer-events: none;
}

.dropzone .link-btn {
  pointer-events: auto;
}

.icon-upload {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.file-name {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.file-name.has-file {
  color: var(--primary);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  pointer-events: auto;
}

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

.restore-row {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.restore-hint {
  margin-bottom: 10px;
}

.restore-actions {
  display: flex;
  gap: 10px;
}

.job-id-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.job-id-input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.job-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 24px;
}

.job-meta dt {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.job-meta dd {
  font-size: 0.9rem;
  margin-top: 2px;
  word-break: break-all;
}

.mono {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.progress-wrap {
  margin-top: 16px;
}

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

.progress-fill {
  height: 100%;
  width: 30%;
  background: var(--primary);
  border-radius: 3px;
  animation: pulse 1.2s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { width: 20%; opacity: 0.7; }
  to { width: 85%; opacity: 1; }
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.result-header h2 {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 500;
  position: sticky;
  top: 0;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

.empty-hint {
  color: var(--warning);
  font-size: 0.85rem;
  margin-top: 12px;
}

.log {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.log .err { color: var(--error); }
.log .ok { color: var(--success); }

.footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 600px) {
  .actions {
    flex-direction: column;
  }
  .restore-actions {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
}

