:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #16191d; --muted: #656d78;
  --line: #dfe3e8; --accent: #2563eb; --accent-ink: #fff;
  --ok: #0f7b40; --ok-bg: #e6f4ec; --warn: #92510b; --warn-bg: #fdf3e3;
  --err: #b3261e; --err-bg: #fdeceb; --code-bg: #f1f3f5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --panel: #1c2025; --ink: #e8eaed; --muted: #9aa3ad;
    --line: #2c323a; --accent: #4d86f7; --accent-ink: #0d1117;
    --ok: #5cc98d; --ok-bg: #16301f; --warn: #e0a75e; --warn-bg: #332711;
    --err: #f2857c; --err-bg: #3a1a18; --code-bg: #23282e;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
header.top {
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 0 20px; display: flex; align-items: center; gap: 22px;
  position: sticky; top: 0; z-index: 10;
}
header.top .brand { font-weight: 650; padding: 14px 0; letter-spacing: -.01em; }
header.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
header.top nav a {
  padding: 14px 12px; text-decoration: none; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 500;
}
header.top nav a:hover { color: var(--ink); }
header.top nav a.active { color: var(--ink); border-bottom-color: var(--accent); }
header.top .who { color: var(--muted); font-size: 13px; }
main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
/* Listenseiten nutzen die Bildschirmbreite. Formulare und Fließtext bleiben
   schmal, weil zu lange Textzeilen schlechter lesbar sind - bei Tabellen ist
   es umgekehrt: Dort kostet jede Umbruchstelle Übersicht. */
main.wide { max-width: min(98vw, 2400px); padding-left: 16px; padding-right: 16px; }
/* Erklärtexte innerhalb breiter Seiten bleiben lesbar begrenzt. */
main.wide .panel > p.hint,
main.wide .panel > .flash { max-width: 105ch; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; margin-bottom: 16px;
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 600; margin-top: 2px; letter-spacing: -.02em; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
     text-transform: uppercase; letter-spacing: .04em; padding: 0 10px 8px; }
td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.scroll { overflow-x: auto; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
pre {
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-size: 13px; margin: 0;
}
.codebox { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.codebox pre { flex: 1; white-space: pre-wrap; word-break: break-all; }
label { display: block; font-weight: 550; margin: 0 0 5px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg); color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.field { margin-bottom: 15px; }
.row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .row { grid-template-columns: 1fr; } }
button, .btn {
  padding: 9px 15px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; font-weight: 550;
  cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-danger { color: var(--err); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.tag.on { background: var(--ok-bg); color: var(--ok); }
.tag.off { background: var(--code-bg); color: var(--muted); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.err { background: var(--err-bg); color: var(--err); }
.auth { max-width: 400px; margin: 9vh auto; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.stepnum {
  display: inline-flex; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; margin-right: 8px;
}
ol.steps { list-style: none; padding: 0; margin: 0; }
ol.steps > li { margin-bottom: 22px; }

/* Passwortfelder mit Sichtbarkeits-Umschalter */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 84px; }
.pw-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  padding: 4px 9px; font-size: 12px; line-height: 1.4; border-radius: 5px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  cursor: pointer; font-family: inherit; font-weight: 500;
}
.pw-toggle:hover { color: var(--ink); border-color: var(--accent); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Kopierfeld im Stil einer Eingabezeile, mit Symbol rechts */
.copyrow { display: flex; align-items: stretch; gap: 0; margin-bottom: 8px; }
.copyrow > .val {
  flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line);
  border-right: none; border-radius: 7px 0 0 7px; background: var(--bg);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; overflow-x: auto; white-space: nowrap; line-height: 1.5;
}
.copyrow > .cbtn {
  display: flex; align-items: center; justify-content: center; width: 40px;
  border: 1px solid var(--line); border-radius: 0 7px 7px 0;
  background: var(--panel); color: var(--muted); cursor: pointer; padding: 0;
}
.copyrow > .cbtn:hover { color: var(--accent); border-color: var(--accent); }
.copyrow > .cbtn svg { width: 16px; height: 16px; }
.copyrow > .cbtn.done { color: var(--ok); }
.codegroup { margin-bottom: 20px; }
.codegroup > h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 0 0 10px; font-weight: 600;
}
.codelabel { font-size: 13px; font-weight: 550; margin: 0 0 3px; }

td.actions-cell { white-space: nowrap; }
td.actions-cell form { display: inline; margin: 0; }
/* Zweizeilige Zellen kompakt halten */
table .sub2 { font-size: 12px; color: var(--muted); line-height: 1.35; }
table td, table th { padding: 9px 8px; }

/* Sicherheitsnetz: Ein Symbol in einem Knopf darf nie den Platz sprengen,
   auch wenn eine spätere Regel fehlt oder eine alte Fassung zwischengespeichert
   ist. */
button svg, .btn svg { width: 1em; height: 1em; vertical-align: -.125em; }

/* Erklaerung beim Darueberfahren. Als freies Element am <body>, nicht im
   <th>: die Tabelle steckt in einem Kasten mit overflow-x, der ein
   absolut positioniertes Kind abschneiden wuerde. */
[data-tip] { cursor: help; }
th[data-tip] { text-decoration: underline dotted; text-underline-offset: 3px;
               text-decoration-color: var(--line); }
th[data-tip]:hover { text-decoration-color: var(--accent); color: var(--accent); }
.tip {
  position: fixed; z-index: 60; left: -9999px; top: 0; display: none;
  max-width: 360px; padding: 10px 12px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  /* Der Spaltenkopf ist versal und gesperrt - das darf nicht durchschlagen. */
  font: 400 13px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-transform: none; letter-spacing: 0; text-align: left;
  white-space: normal; pointer-events: none;
}
.tip b { display: block; margin-bottom: 3px; font-size: 12px;
         text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Ein gesperrter Knopf muss auch gesperrt aussehen, sonst klickt man ins
   Leere und haelt es fuer einen Fehler. */
button:disabled, .btn:disabled {
  opacity: .45; cursor: not-allowed;
}

/* Wirkt gesperrt, ist es aber technisch nicht: Ein echtes `disabled`
   verschluckt Mausereignisse, dann erscheint kein Hinweis und der Benutzer
   sieht nur einen durchgestrichenen Kreis ohne Erklaerung. */
.gesperrt {
  opacity: .5; cursor: help; border-style: dashed;
}
.gesperrt:hover { opacity: .75; }
