:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #232632;
  --border: #2e3345;
  --text: #e4e6f0;
  --text-dim: #8b8fa3;
  --accent: #6c5ce7;
  --accent-hover: #7c6cf7;
  --success: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --radius: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

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

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Header ────────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

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

.header h1 span { color: var(--accent); }

.header a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
}
.header a:hover { color: var(--text); }

/* ── Cards ─────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

/* ── Forms ─────────────────────────────────────── */

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

textarea {
  font-family: var(--mono);
  font-size: 0.82rem;
  resize: vertical;
  min-height: 200px;
}

.form-group { margin-bottom: 1rem; }
.form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}
.form-row .form-group { flex: 1; }

/* ── Buttons ───────────────────────────────────── */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}

button:hover, .btn:hover { background: var(--accent-hover); }

button.secondary {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
button.secondary:hover {
  background: var(--border);
  color: var(--text);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Login ─────────────────────────────────────── */

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
}

.error-msg {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

/* ── Pipeline Status / Log ─────────────────────── */

.log-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 600px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.8;
}

.log-entry {
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(46, 51, 69, 0.4);
}

.log-entry .stage {
  display: inline-block;
  min-width: 110px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.log-entry .task-tag {
  color: var(--warning);
  font-size: 0.7rem;
}

.log-entry.error .stage { color: var(--danger); }
.log-entry.done .stage { color: var(--success); }

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status-badge.running { background: rgba(108,92,231,0.2); color: var(--accent); }
.status-badge.completed { background: rgba(46,204,113,0.2); color: var(--success); }
.status-badge.error { background: rgba(231,76,60,0.2); color: var(--danger); }
.status-badge.terminated { background: rgba(243,156,18,0.2); color: var(--warning); }

button.btn-danger {
  background: var(--danger);
  color: #fff;
}
button.btn-danger:hover {
  background: #c0392b;
}
button.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Table ─────────────────────────────────────── */

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

th {
  text-align: left;
  padding: 0.5rem;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.5rem;
  border-bottom: 1px solid rgba(46, 51, 69, 0.4);
}

/* ── Responsive ────────────────────────────────── */

@media (max-width: 640px) {
  .form-row { flex-direction: column; }
  .container { padding: 1rem; }
}
