:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #d9dce1;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #2563eb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  background: #1e293b;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
header h1 { margin: 0; font-size: 20px; }
header span { color: #94a3b8; font-size: 13px; }
header nav { margin-left: auto; display: flex; gap: 8px; }
.tab {
  margin-top: 0;
  background: transparent;
  color: #cbd5e1;
  border: 1px solid #475569;
  padding: 6px 16px;
  font-weight: 600;
}
.tab:hover { background: #334155; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
[hidden] { display: none !important; }
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
main > div { display: grid; gap: 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}
.card h2 { margin: 0 0 16px; font-size: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.card-head button { margin-top: 0; }
form .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
label .req { color: #dc2626; }
input, textarea, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
textarea { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 13px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.full { grid-column: 1 / -1; }
button {
  margin-top: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #1d4ed8; }
#form-msg { margin-top: 12px; font-size: 14px; display: none; padding: 8px 12px; border-radius: 6px; }
#form-msg.ok { display: block; background: #dcfce7; color: #166534; }
#form-msg.err { display: block; background: #fee2e2; color: #991b1b; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sortable.active { color: var(--accent); }
.sort-ind { font-size: 10px; color: var(--border); }
th.sortable.active .sort-ind { color: var(--accent); }
td.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.pending { background: #e5e7eb; color: #374151; }
.badge.running { background: #dbeafe; color: #1d4ed8; }
.badge.done    { background: #dcfce7; color: #166534; }
.badge.failed  { background: #fee2e2; color: #991b1b; }
.badge.up      { background: #dcfce7; color: #166534; }
.badge.down    { background: #e5e7eb; color: #374151; }
.empty { color: var(--muted); text-align: center; padding: 24px; }
/* Inline-Ladeindikator (z.B. während ein synchroner Hook läuft). */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -1px;
  margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* In der Status-LED-Zelle steht der Spinner allein — kein seitlicher Abstand nötig. */
.status-ind .spinner { margin-right: 0; vertical-align: middle; }
/* Status-LED: up = grün (mit dezentem Leuchten), down/unbekannt = grau. */
.status-ind { display: inline-flex; align-items: center; justify-content: center; min-width: 14px; }
.led {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #9ca3af;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.led.up { background: #22c55e; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 5px rgba(34, 197, 94, 0.7); }
.led.down { background: #9ca3af; }
.ts { white-space: nowrap; color: var(--muted); font-size: 12px; }
.actions { white-space: nowrap; }
button.sm {
  margin-top: 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
button.ghost { background: #e5e7eb; color: #374151; }
button.ghost:hover { background: #d1d5db; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
/* Kebab-Button (Zeilen-Aktionen) */
button.kebab {
  margin-top: 0;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 2px 9px;
  font-size: 18px;
  line-height: 1.2;
  border-radius: 6px;
}
button.kebab:hover { background: #e5e7eb; }
/* Schwebendes Zeilen-Aktionsmenü (Popover) */
.rowmenu {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  padding: 6px;
}
.rowmenu button {
  display: block;
  width: 100%;
  margin: 0;
  text-align: left;
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 500;
}
.rowmenu button:hover { background: #f1f5f9; }
.rowmenu .ico { display: inline-block; width: 1.5em; margin-right: 8px; text-align: center; }
.rowmenu button.danger { color: #b91c1c; background: transparent; }
.rowmenu button.danger:hover { background: #fee2e2; }
.rowmenu hr { border: none; border-top: 1px solid var(--border); margin: 6px 0; }
/* Detail-/Editier-Modal */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 50;
  padding: 24px;
  overflow-y: auto;
}
.overlay.open { display: flex; align-items: flex-start; justify-content: center; }
.modal {
  background: var(--card);
  border-radius: 8px;
  width: 100%;
  max-width: 760px;
  padding: 24px;
  margin: auto;
}
.modal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.meta { margin: 14px 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; }
.meta b { color: var(--text); font-weight: 600; }
pre.log {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
.modal-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.modal-actions button { margin-top: 0; }
#modal-msg { margin-top: 12px; font-size: 14px; display: none; padding: 8px 12px; border-radius: 6px; }
#modal-msg.ok { display: block; background: #dcfce7; color: #166534; }
#modal-msg.err { display: block; background: #fee2e2; color: #991b1b; }
#jcmodal-msg, #pmodal-msg, #pcmodal-msg { margin-top: 12px; font-size: 14px; display: none; padding: 8px 12px; border-radius: 6px; }
#jcmodal-msg.ok, #pmodal-msg.ok, #pcmodal-msg.ok { display: block; background: #dcfce7; color: #166534; }
#jcmodal-msg.err, #pmodal-msg.err, #pcmodal-msg.err { display: block; background: #fee2e2; color: #991b1b; }
dl.fields { margin: 14px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
dl.fields dt { color: var(--muted); font-weight: 600; }
dl.fields dd { margin: 0; }
/* Login */
.login-overlay { background: #1e293b; }
.login-modal { max-width: 360px; }
.login-modal h2 { margin: 0 0 16px; font-size: 18px; }
.login-modal .field { margin-bottom: 12px; }
.login-modal button { width: 100%; }
#login-msg { margin-top: 12px; font-size: 14px; display: none; padding: 8px 12px; border-radius: 6px; }
#login-msg.err { display: block; background: #fee2e2; color: #991b1b; }
#me-info { align-self: center; }
/* Deaktivierte Projekte deutlich markieren: gedimmte Zeile. */
tr.disabled { background: #f8fafc; }
tr.disabled td:not(.actions) { color: var(--muted); opacity: 0.7; }
