:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --accent-h: #4493f8;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: normal; }
.error { color: var(--red); margin-top: 8px; font-size: 13px; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  transition: .15s;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); }
button.primary:hover { background: var(--accent-h); }
button.ghost { background: transparent; }
button.danger { background: var(--red); border-color: var(--red); }
button.danger:hover { opacity: .9; }

input, textarea {
  font: inherit;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; width: 320px;
  display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p { margin: 0; }

/* Header */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg2); position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 16px; }
nav { display: flex; gap: 8px; align-items: center; }
.tab { background: transparent; border-color: transparent; }
.tab.active { background: var(--bg3); border-color: var(--border); }

main { max-width: 1000px; margin: 0 auto; padding: 24px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.toolbar h2 { margin: 0; font-size: 18px; }

/* Cards */
.cards { display: grid; gap: 12px; }
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.card .info { min-width: 0; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card .meta { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.card .meta code { background: var(--bg3); padding: 1px 6px; border-radius: 5px; }
.card .actions { display: flex; gap: 8px; flex-shrink: 0; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--bg3); }
.badge.off { color: var(--muted); }
.badge.on { color: var(--green); }

/* Runs table */
.runs-table { width: 100%; border-collapse: collapse; }
.runs-table th, .runs-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.runs-table th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; }
.runs-table tr:hover td { background: var(--bg2); }
.status { font-weight: 600; }
.status.running { color: var(--accent); }
.status.success { color: var(--green); }
.status.failed  { color: var(--red); }
.status.stopped, .status.interrupted { color: var(--yellow); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 480px; max-width: 100%; max-height: 90vh; overflow: auto; }
.modal-card h3 { margin: 0 0 16px; }
#job-form { display: flex; flex-direction: column; gap: 12px; }
#job-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
#job-form .row { display: flex; gap: 12px; }
#job-form .row label { flex: 1; }
label.checkbox { flex-direction: row !important; align-items: center; gap: 8px; color: var(--text); }
label.checkbox input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* Log */
.log-card { width: 760px; display: flex; flex-direction: column; }
.log-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.log-head h3 { margin: 0; }
.log-output {
  background: #010409; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; height: 60vh; overflow: auto; margin: 0;
  font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.empty { color: var(--muted); padding: 40px; text-align: center; }

/* Datei-Browser */
.controls { display: flex; gap: 10px; align-items: center; }
.ctl { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.ctl select { width: auto; padding: 6px 8px; }
.ctl input { width: auto; }
.bulkbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; padding: 10px 12px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; }
.bulkbar .spacer { flex: 1; }

.filegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.file {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; position: relative;
}
.file.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.file .thumb {
  height: 120px; background: var(--bg); display: grid; place-items: center;
  cursor: pointer; overflow: hidden; position: relative;
}
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .thumb .icon { font-size: 42px; }
.file .fbody { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.file .fname { font-size: 12.5px; word-break: break-all; line-height: 1.3; max-height: 2.6em; overflow: hidden; }
.file .fmeta { font-size: 11px; color: var(--muted); }
.file .frow { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.file .frow button, .file .frow a { padding: 4px 8px; font-size: 12px; }
.file .selbox { position: absolute; top: 6px; left: 6px; z-index: 2; width: 18px; height: 18px; cursor: pointer; }
.file .bdg {
  position: absolute; top: 6px; right: 6px; font-size: 14px;
  background: rgba(0,0,0,.55); border-radius: 50%; width: 24px; height: 24px;
  display: grid; place-items: center; cursor: pointer;
}
.file .bdg.on { color: var(--green); }
.file .bdg.off { color: var(--muted); opacity: .5; }

.btn-link { display: inline-block; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); background: var(--bg3); padding: 8px 14px; border-radius: 8px; }
.btn-link:hover { border-color: var(--muted); }

.preview-card { width: 860px; max-width: 96vw; }
.preview-body { display: grid; place-items: center; min-height: 200px; max-height: 78vh; overflow: auto; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 76vh; }
.preview-body iframe { width: 100%; height: 76vh; border: 0; background: #fff; border-radius: 6px; }
.preview-body pre { width: 100%; white-space: pre-wrap; word-break: break-word; margin: 0;
  font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--text); }
.preview-body audio { width: 100%; }

/* Auth-Box im Job-Editor */
.auth-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.auth-box summary { cursor: pointer; font-size: 13px; color: var(--text); }
.auth-box[open] summary { margin-bottom: 10px; }
.auth-box label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.auth-box .hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.auth-box .sep { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 4px; }
