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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  min-height: 100vh;
  background: #0d1117;
  color: #c9d1d9;
}

/* ── Login overlay ───────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: #0d1117;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

#login-overlay.logged-in {
  display: none;
}

.login-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 32px;
  width: 360px;
  text-align: center;
}

.login-box h2 {
  margin-bottom: 8px;
  color: #58a6ff;
}

.login-box p {
  color: #8b949e;
  margin-bottom: 16px;
  font-size: 14px;
}

.login-box input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #c9d1d9;
  font-size: 16px;
  text-align: center;
}

.login-box input[type="password"]:focus {
  outline: none;
  border-color: #58a6ff;
}

.sidebar {
  width: 220px;
  background: #161b22;
  border-right: 1px solid #30363d;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar h2 {
  font-size: 16px;
  color: #58a6ff;
}

.nav-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: #8b949e;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  transition: all .15s;
}

.nav-btn:hover { background: #1c2128; color: #c9d1d9; }
.nav-btn.active { background: #1f6feb22; color: #58a6ff; font-weight: 600; }

.main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.section { display: none; }
.section.active { display: block; }

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

.section-header h2 { font-size: 22px; }

.btn {
  padding: 8px 16px;
  border: 1px solid #30363d;
  background: #21262d;
  color: #c9d1d9;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.btn:hover { background: #30363d; }
.btn-primary { background: #238636; border-color: #2ea043; color: #fff; }
.btn-primary:hover { background: #2ea043; }
.btn-danger { background: #da3633; border-color: #f85149; color: #fff; }
.btn-danger:hover { background: #f85149; }
.btn-run { background: #1f6feb; border-color: #388bfd; color: #fff; font-size: 15px; padding: 12px 24px; }
.btn-run:hover { background: #388bfd; }

.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.card h3 { font-size: 14px; color: #8b949e; margin-bottom: 8px; }
.card label { display: block; font-size: 12px; color: #8b949e; margin: 8px 0 4px; }
.card input, .card textarea, .card select {
  width: 100%;
  padding: 8px 10px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  font-size: 13px;
}
.card textarea { font-family: monospace; resize: vertical; min-height: 60px; }

.user-card .user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.user-card .user-header h3 { font-size: 16px; color: #c9d1d9; }
.user-card .user-body { margin-top: 12px; display: none; }
.user-card.expanded .user-body { display: block; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.tag { background: #1f6feb22; color: #58a6ff; padding: 3px 8px; border-radius: 12px; font-size: 12px; }

.user-actions { display: flex; gap: 8px; margin-top: 12px; }

.cv-item {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.cv-item h3 { font-size: 16px; margin-bottom: 8px; }
.cv-item textarea {
  width: 100%;
  min-height: 300px;
  font-family: monospace;
  font-size: 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  padding: 10px;
}

.config-grid { display: grid; gap: 16px; }
.config-grid pre {
  background: #0d1117;
  padding: 12px;
  border-radius: 4px;
  font-size: 12px;
  overflow-x: auto;
}

.pipeline-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

#pipeline-status {
  padding: 12px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  width: 100%;
  min-height: 40px;
  max-height: 600px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

#logs-output {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 16px;
  font-family: monospace;
  font-size: 12px;
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre-wrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-overlay.hidden { display: none; }

/* ── Scheduler ───────────────────────────────── */
.scheduler-status {
  max-width: 600px;
}

.scheduler-status .card p {
  font-size: 14px;
  line-height: 1.8;
}

.scheduler-status strong {
  color: #8b949e;
  font-weight: 500;
}

.modal {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 { margin-bottom: 16px; }
.modal .form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #238636;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  animation: slideIn .3s ease;
}

.toast.error { background: #da3633; }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
