:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1d222a;
  --line: #2a313b;
  --text: #e6e9ee;
  --muted: #8b94a3;
  --accent: #4f8cff;
  --ok: #3ecf8e;
  --warn: #e6b800;
  --bad: #ff5f56;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --panel-2: #f0f2f5;
    --line: #dfe3e9;
    --text: #1b1f24;
    --muted: #6b7280;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body.centered {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: 13px; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* --- Kopfzeile ---------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.brand span { color: var(--muted); font-weight: 400; margin-left: 2px; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted);
}
.topbar nav a:hover { background: var(--panel-2); text-decoration: none; }
.topbar nav a.on { background: var(--panel-2); color: var(--text); }
.logout { margin: 0; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 20px;
}
.head h2 { margin: 0; font-size: 22px; }
.row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.row .grow { flex: 1; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

/* --- Karten und Formulare ---------------------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; letter-spacing: 0.01em; }
.card.danger { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.card.highlight { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.hidden { display: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
label.wide { display: block; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
label.check input { width: auto; margin: 0; }

input, select, textarea {
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}
input[readonly] { color: var(--muted); cursor: pointer; }
input.copied { border-color: var(--ok); }
textarea { font-family: var(--mono); font-size: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }

button, .btn {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
button.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; }
button.link { background: none; border: none; color: var(--muted); padding: 6px 8px; }
form.inline { display: inline; }

/* --- Tabellen ----------------------------------------------------------- */

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: none; }
table.list td.right { text-align: right; }
table.list td.nowrap { white-space: nowrap; }
table.result td { font-family: var(--mono); font-size: 12px; white-space: pre; }
.scroll { overflow-x: auto; }
.wrap { overflow-wrap: anywhere; }

dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; overflow-wrap: anywhere; }

.muted { color: var(--muted); font-size: 13px; }
.strong { font-weight: 600; color: var(--text); }
.bad-text { color: var(--bad); }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.empty { padding: 48px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.off { background: var(--line); }

/* --- Logs und Meldungen ------------------------------------------------- */

/* --- Diagnose ----------------------------------------------------------- */

ul.checks { list-style: none; margin: 0; padding: 0; }
ul.checks li { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
ul.checks li:last-child { border-bottom: none; }
.check-name { font-size: 14px; }
.badge {
  flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #0b0d11;
}
.badge.ok { background: var(--ok); }
.badge.warn { background: var(--warn); }
.badge.fail { background: var(--bad); }

.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 10px; }
.bar input[type="search"] { width: 220px; margin: 0; padding: 6px 10px; font-size: 13px; }
.bar label.check { margin: 0; }

pre.log .l-step { color: #7cb7ff; font-weight: 600; }
pre.log .l-warn { color: #ffd166; }
pre.log .l-bad { color: #ff8b84; font-weight: 600; }
pre.log .l-ok { color: #6ee7b7; }
pre.log mark { background: #3a4a2a; color: #e6e9ee; }

pre.log {
  margin: 0;
  max-height: 380px;
  overflow: auto;
  background: #0b0d11;
  color: #cdd6e3;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
pre.log.short { max-height: 220px; }
pre.log.tall { max-height: 520px; }
pre.log.done-ok { border-color: var(--ok); }
pre.log.done-bad { border-color: var(--bad); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--panel); }
.flash.ok { border-color: var(--ok); }
.flash.error { border-color: var(--bad); }
.flash pre { margin: 0; white-space: pre-wrap; }

/* --- Login -------------------------------------------------------------- */

.login { width: min(360px, 100%); }
.login h1 { margin: 0 0 20px; font-size: 20px; }
.login h1 span { color: var(--muted); font-weight: 400; }
.login button { width: 100%; margin-top: 6px; }

/* Freitextfeld unter einer Auswahlliste - fuer den Fall, dass GitHub
   nicht erreichbar ist oder eine URL von Hand kommen soll. */
input.secondary { margin-top: 6px; font-size: 12px; color: var(--muted); }
input.secondary:focus { color: var(--text); }
label select + input.secondary { border-style: dashed; }
