:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --text: #1d2329;
    --muted: #6b7480;
    --line: #e3e6ea;
    --primary: #2457c5;
    --primary-dark: #1b449c;
    --good: #12805c;
    --good-bg: #e3f4ec;
    --warn: #a35a00;
    --warn-bg: #fff2dd;
    --bad: #c0262d;
    --bad-bg: #fde7e8;
    --radius: 8px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
code, pre { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.good { color: var(--good); }
.warn { color: var(--warn); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.break { word-break: break-all; }
.mt { margin-top: 1rem; }

/* Kopfzeile */
.topbar {
    display: flex; align-items: center; gap: 1.5rem;
    background: #17202b; color: #fff; padding: .6rem 1.5rem;
    position: sticky; top: 0; z-index: 10;
}
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #c9d1db; padding: .35rem .7rem; border-radius: 6px; }
.topbar nav a:hover, .topbar nav a.active { background: #2a3644; color: #fff; text-decoration: none; }
.logout { display: flex; align-items: center; gap: .6rem; margin: 0; }
.logout .btn-ghost { color: #c9d1db; border-color: #3a4757; }

.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }
.container.narrow { max-width: 720px; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 1rem; }

/* Karten */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
}
.card-warn { border-color: #f0c27a; background: #fffaf0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.card.empty { text-align: center; padding: 3rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 1.25rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; }
.tile-num { font-size: 1.5rem; font-weight: 700; }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile-good { border-left-color: var(--good); }
.tile-warn { border-left-color: #e89b2c; }
.tile-bad { border-left-color: var(--bad); }

/* Buttons */
.btn {
    display: inline-block; padding: .45rem .9rem; border: 1px solid #cfd5dc; border-radius: 6px;
    background: #fff; color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; line-height: 1.3;
}
.btn:hover { background: #f1f3f5; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #9e1d23; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .25rem .6rem; font-size: .85rem; }
.btn-block { width: 100%; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table tbody tr:hover { background: #fafbfc; }
.table-compact td, .table-compact th { padding: .35rem .5rem; font-size: .9rem; }
.actions { text-align: right; white-space: nowrap; }
.toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filter { margin-left: auto; max-width: 220px; }

/* Status */
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .2rem; vertical-align: middle; }
.dot-up { background: var(--good); }
.dot-down { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.dot-off { background: #b8c0c9; }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
a.badge:hover { text-decoration: none; filter: brightness(.95); }

/* Meldungen */
.alert { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-info { background: #e8f0fd; border-color: #c7d8f7; }
.alert-success { background: var(--good-bg); border-color: #b5e0cb; }
.alert-warning { background: var(--warn-bg); border-color: #f3d29b; }
.alert-error { background: var(--bad-bg); border-color: #f4b9bc; }
.toast {
    position: fixed; right: 1.25rem; bottom: 1.25rem; max-width: 480px; white-space: pre-wrap;
    padding: .8rem 1.1rem; border-radius: 8px; color: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 100;
}
.toast-ok { background: #17694d; }
.toast-bad { background: #a3242a; }

/* Fortschritt */
.progress { background: #f8f9fb; border: 1px solid var(--line); border-radius: 6px; padding: .75rem 1rem; margin-bottom: 1rem; max-height: 320px; overflow: auto; }
.progress-head { font-weight: 600; margin-bottom: .4rem; }
.progress-line { font-size: .9rem; padding: .1rem 0; }
.progress .btn { margin-top: .5rem; }

/* Formulare */
.form label { display: block; margin-bottom: .8rem; font-weight: 500; }
.form label.check, label.check { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=search], select, textarea {
    display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem;
    border: 1px solid #cfd5dc; border-radius: 6px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b9cdf3; border-color: var(--primary); }
.toolbar input[type=search] { margin-top: 0; }
.form h2 { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.form h2:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 1rem; align-items: end; }
.hint { color: var(--muted); font-size: .88rem; margin: -.5rem 0 .9rem; }
.form-actions { display: flex; gap: .5rem; margin-top: 1rem; }
.danger-zone { border-color: #f4b9bc; }
.login { width: 100%; max-width: 380px; }
.login h1 { text-align: center; margin-bottom: 1rem; }

/* Sonstiges */
.keybox { display: flex; align-items: center; gap: .75rem; background: #f6f8fa; border: 1px dashed #c4ccd5; border-radius: 6px; padding: .75rem 1rem; margin: 1rem 0; }
.keybox code { flex: 1; word-break: break-all; font-size: 1rem; }
.code { background: #17202b; color: #e6edf3; padding: .75rem 1rem; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.steps li { margin-bottom: .4rem; }
.checks { list-style: none; padding: 0; margin: 0; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.25rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.log { list-style: none; padding: 0; margin: 0; max-height: 420px; overflow: auto; }
.log li { padding: .45rem 0 .45rem .7rem; border-bottom: 1px solid var(--line); border-left: 3px solid var(--line); }
.log li.log-warning { border-left-color: #e89b2c; }
.log li.log-error { border-left-color: var(--bad); }
tr.log-error td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.log-warning td:first-child { box-shadow: inset 3px 0 0 #e89b2c; }
details summary { cursor: pointer; color: var(--primary); }

/* Antwortzeit-Diagramm */
.spark { width: 100%; height: 120px; display: block; background: #fafbfc; border-radius: 6px; }
.spark-line { fill: none; stroke: var(--primary); stroke-width: 1.5; }
.spark-fail { fill: var(--bad); opacity: .35; }
.spark-legend { display: flex; justify-content: space-between; margin-top: .25rem; }

/* QR-Code für 2FA */
.qr-wrap { display: inline-block; padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin: .25rem 0 1rem; }
.qr { display: block; width: 220px; height: 220px; }
