:root {
  --bg: #0b0d10; --panel: #14171c; --panel2: #1a1e24; --line: #262b33;
  --fg: #e7eaee; --muted: #8b929d; --accent: #5b8cff; --ok: #3fb950; --err: #f85149;
  --run: #d29922;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px; line-height: 1.5;
}
.view { min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--err); font-size: 13px; min-height: 1em; }

/* Login */
#login { display: grid; place-items: center; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 36px; width: min(92vw, 380px); text-align: center;
}
.brand { font-weight: 700; font-size: 26px; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.brand.small { font-size: 18px; }

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: rgba(11,13,16,.85); backdrop-filter: blur(8px);
}
.who { display: flex; align-items: center; gap: 12px; }
#who-name { color: var(--muted); font-size: 14px; }

main { padding: 20px; max-width: 1100px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; margin-bottom: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; }
select, textarea, input {
  width: 100%; background: var(--panel2); border: 1px solid var(--line);
  color: var(--fg); border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 14px;
}
#login-form { text-align: left; }
#login-form button { width: 100%; }
textarea { resize: vertical; }

button {
  cursor: pointer; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500;
  padding: 9px 14px; border: 1px solid var(--line); background: var(--panel2); color: var(--fg);
}
button.primary { background: var(--accent); border-color: var(--accent); color: white; margin-top: 14px; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: default; }

.status { margin-top: 12px; font-size: 13px; min-height: 1.2em; }
.status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.dot.queued { background: var(--muted); } .dot.running { background: var(--run); }
.dot.done { background: var(--ok); } .dot.failed, .dot.denied { background: var(--err); }

.result {
  margin-top: 14px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px; font-size: 14px; white-space: normal;
}
.result h3 { font-size: 14px; margin: 12px 0 4px; }
.result p { margin: 6px 0; }

.chips { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 12px; color: var(--muted); }

.joblist { list-style: none; padding: 0; margin: 6px 0 0; }
.joblist li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.joblist li:last-child { border-bottom: none; }
.joblist .mod { color: var(--fg); } .joblist .ts { color: var(--muted); margin-left: auto; font-size: 12px; }

/* Audit-Rubrik (Block 2) */
.audit-card {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; margin-bottom: 12px; cursor: pointer;
}
.audit-card:hover { border-color: var(--accent); }
.audit-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.badge {
  background: var(--panel); border: 1px solid var(--accent); color: var(--accent);
  border-radius: 999px; padding: 1px 10px; font-size: 12px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 60%;
}
.phasebar { display: flex; gap: 4px; margin: 6px 0 8px; }
.phasebar .seg {
  flex: 1; text-align: center; font-size: 11px; padding: 3px 0; border-radius: 5px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.phasebar .seg.done { background: var(--ok); border-color: var(--ok); color: #06110a; font-weight: 600; }
.phasebar .seg.active { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
.gates { display: flex; gap: 6px; flex-wrap: wrap; }
.gate {
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px;
  font-size: 12px; color: var(--muted); background: var(--panel);
}
.gate.ok { color: var(--ok); border-color: var(--ok); }
.audit-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 4px 0; }
.pre { white-space: pre-wrap; }
#audit-detail h3 { font-size: 14px; margin: 16px 0 6px; }
.audit-open { padding-left: 18px; margin: 4px 0; }
.audit-open li { margin: 4px 0; }
.audit-open li.done { text-decoration: line-through; color: var(--muted); }
.audit-facts { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
#btn-audit-back { margin-bottom: 10px; }

/* User-Management (Block 3) */
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-head h2 { margin: 0; }
.user-card {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; margin-bottom: 12px;
}
.user-card.revoked { opacity: .6; }
.badge.warn { border-color: var(--err); color: var(--err); }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; margin-top: 4px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg); margin: 4px 0; }
.checkline input { width: auto; margin: 0; flex-shrink: 0; }
.uf-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.uf-actions .primary { margin-top: 0; }
#user-form-wrap { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
#user-form-wrap h3 { font-size: 14px; margin: 12px 0 4px; }

/* Einmal-Passwort-Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50;
  display: grid; place-items: center;
}
.modal-card { text-align: left; }
#pw-value {
  display: block; background: var(--panel2); border: 1px solid var(--accent);
  border-radius: 8px; padding: 12px; font-size: 16px; letter-spacing: .04em;
  word-break: break-all; user-select: all; margin-top: 8px;
}
