:root {
  --bg: #0b1020;
  --surface: #121a2f;
  --surface-2: #18233f;
  --border: #253459;
  --text: #e8eefc;
  --muted: #93a4c7;
  --accent: #4f8cff;
  --accent-hover: #3b7bff;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.14);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  background: radial-gradient(circle at 15% 0%, #162242 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, #4f8cff, #7c5cff);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.server-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.server-pill.online .dot {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.server-pill.offline .dot {
  background: var(--danger);
}

.workspace {
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.dropzone {
  border: 2px dashed #354c7c;
  border-radius: 12px;
  background: rgba(24, 35, 63, 0.55);
  padding: 32px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.1);
  outline: none;
}

.dropzone.dragover {
  transform: scale(1.01);
}

.dropzone-icon {
  color: var(--accent);
  margin-bottom: 10px;
}

.dropzone-title {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
}

.dropzone-sub {
  margin: 4px 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}

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

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

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

.btn-success {
  background: var(--success);
  color: #062111;
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
  color: #fff;
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: #3c5385;
}

.settings-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.target-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#targetKbInput {
  width: 110px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.chip.active,
.chip:hover {
  border-color: var(--accent);
  color: #fff;
  background: rgba(79, 140, 255, 0.2);
}

.field-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.error-banner {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
  font-size: 13px;
}

.results-head {
  flex-wrap: wrap;
}

.summary-line {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

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

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.job-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.job-name {
  font-weight: 600;
  font-size: 14.5px;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-queued {
  background: rgba(147, 164, 199, 0.15);
  color: var(--muted);
}

.badge-processing {
  background: var(--warn-bg);
  color: #fcd34d;
}

.badge-done {
  background: var(--success-bg);
  color: #86efac;
}

.badge-error {
  background: var(--danger-bg);
  color: #fca5a5;
}

.spinner {
  width: 11px;
  height: 11px;
  border: 2px solid rgba(252, 211, 77, 0.35);
  border-top-color: #fcd34d;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.job-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  font-size: 13px;
  color: var(--muted);
}

.metric strong {
  color: var(--text);
}

.saving-pill {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--success-bg);
  color: #4ade80;
  font-weight: 700;
  font-size: 12.5px;
}

.job-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.strategy-text {
  font-size: 12px;
  color: var(--muted);
}

.error-text {
  font-size: 12.5px;
  color: #fca5a5;
}

