* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Helvetica, 'Helvetica Neue', Arial, sans-serif;
}

:root {
  --accent: #667eea;
  --accent-dark: #764ba2;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --panel-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --gray: #64748b;
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 20px;
}

.page-wrapper {
  width: 100%;
  max-width: 900px;
}

.panel-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  padding: 32px;
  margin-bottom: 24px;
}

.panel-header {
  text-align: center;
  margin-bottom: 28px;
}

.panel-title {
  font-size: 28px;
  font-weight: 800;
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel-subtitle {
  color: var(--gray);
  font-size: 14px;
  margin-top: 4px;
}

/* -- New Job Form ---------------------------------------- */

.new-job-form {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid #e2e8f0;
}

.form-title {
  font-size: 16px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.grow { flex: 1; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group select,
.form-group input {
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color var(--transition);
  outline: none;
}

.form-group select:focus,
.form-group input:focus {
  border-color: var(--accent);
}

.btn-start {
  padding: 10px 20px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-start:hover { background: #059669; transform: translateY(-1px); }
.btn-start:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* -- Jobs List ------------------------------------------- */

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

.job-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  box-shadow: var(--card-shadow);
  border: 2px solid transparent;
  transition: all var(--transition);
}

.job-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.job-card.active { border-color: var(--green); }
.job-card.stopped { border-color: #e2e8f0; opacity: 0.7; }

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

.job-source-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.job-source-badge.laptime { background: #dbeafe; color: #1d4ed8; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.active { background: #d1fae5; color: #065f46; }
.status-badge.stopped { background: #f1f5f9; color: #64748b; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-badge.active .status-dot { background: var(--green); animation: pulse 2s infinite; }
.status-badge.stopped .status-dot { background: #94a3b8; }

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

.job-url {
  font-size: 13px;
  color: var(--gray);
  word-break: break-all;
  margin-bottom: 12px;
}

.job-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.job-stat {
  font-size: 12px;
  color: #475569;
}

.job-stat strong {
  color: #1e293b;
}

.job-error {
  font-size: 12px;
  color: var(--red);
  background: #fef2f2;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  word-break: break-all;
}

.job-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-stop {
  padding: 6px 16px;
  background: var(--red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-stop:hover { background: #dc2626; }
.btn-stop:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-restart {
  padding: 6px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-restart:hover { background: var(--accent-dark); }
.btn-restart:disabled { opacity: 0.5; cursor: not-allowed; }

/* -- Empty State ----------------------------------------- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
}

/* -- Status Message -------------------------------------- */

.status-message {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 16px;
  display: none;
  transition: opacity var(--transition);
}

.status-message.show { display: block; }
.status-message.success { background: #d1fae5; color: #065f46; }
.status-message.error { background: #fef2f2; color: #991b1b; }
.status-message.info { background: #dbeafe; color: #1e40af; }

/* -- Loading --------------------------------------------- */

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px;
  gap: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* -- Responsive ------------------------------------------ */

@media (max-width: 600px) {
  .panel-container { padding: 20px 16px; }
  .panel-title { font-size: 24px; }
  .form-row { flex-direction: column; }
  .job-stats { flex-direction: column; gap: 6px; }
}
