/* Raindancer Incident Management */
:root {
  --brand: #26add9;
  --brand-dark: #1a8db4;
  --brand-soft: #e6f6fb;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --border: #dde4ea;
  --text: #1d2a35;
  --muted: #64748b;
  --ok: #15803d;      --ok-soft: #e7f6ec;
  --warn: #b45309;    --warn-soft: #fdf3e2;
  --danger: #c0262d;  --danger-soft: #fcebec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 42, 67, .06), 0 4px 16px rgba(16, 42, 67, .05);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; font-weight: 600; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 22px 22px 14px; border-bottom: 1px solid var(--border); }
.sidebar .brand img { width: 170px; display: block; }
.sidebar .brand .product { margin-top: 6px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav .section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar .account { border-top: 1px solid var(--border); padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; }
.account .who { flex: 1; min-width: 0; }
.account .who a { color: var(--text); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .who span { font-size: .78rem; color: var(--muted); }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--bg); color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; display: block; }

.main { padding: 28px 36px 48px; max-width: 1200px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .muted { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.card.narrow { max-width: 640px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 20px; }
.grid .card { margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .value { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: .88rem; }
.card.danger-zone { border-color: #f1c4c7; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand);
  color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #9f1d23; }
.btn.small { padding: 5px 11px; font-size: .86rem; }
.btn.block { width: 100%; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .92rem; }
.field .help { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.field .errorlist { color: var(--danger); font-size: .85rem; margin: 4px 0 0; padding: 0; list-style: none; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit;
  background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(38, 173, 217, .2); }
.field.checkbox { display: flex; align-items: center; gap: 8px; }
.field.checkbox > label { margin: 0; font-weight: 500; order: 2; }
.field.checkbox input { order: 1; width: 17px; height: 17px; accent-color: var(--brand); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checks input { width: 17px; height: 17px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-errors { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.form-errors ul { margin: 0; padding-left: 18px; }
.code-input { font-family: var(--mono); font-size: 1.35rem !important; letter-spacing: .3em; text-align: center; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin: 0 0 16px; }
legend { font-weight: 600; padding: 0 6px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #fafcfd; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfd; }
td.nowrap, th.nowrap { white-space: nowrap; }
.card.flush { padding: 0; overflow: hidden; }

/* ---------- Badges, alerts ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe5cb; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #f2d7a8; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: #f1c4c7; }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); border-color: #bfe6f3; }
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.messages li { padding: 11px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.messages .success { background: var(--ok-soft); border-color: #bfe5cb; color: #14532d; }
.messages .error { background: var(--danger-soft); border-color: #f1c4c7; color: #7f1d1d; }
.messages .warning { background: var(--warn-soft); border-color: #f2d7a8; color: #78350f; }
.messages .info { background: var(--brand-soft); border-color: #bfe6f3; color: #0c4a6e; }
.callout { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: 12px 16px; border-radius: 0 8px 8px 0; margin-bottom: 16px; }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }

/* ---------- 2FA ---------- */
.setup { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.qr { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.qr svg { width: 100%; height: auto; display: block; }
.secret { font-family: var(--mono); background: var(--bg); padding: 8px 12px; border-radius: 8px; word-break: break-all; display: inline-block; }
.steps { padding-left: 20px; margin: 0 0 16px; }
.steps li { margin-bottom: 6px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; font-family: var(--mono); font-size: 1.1rem; background: var(--bg); border-radius: 10px; padding: 18px 22px; margin: 0 0 16px; list-style: none; }

/* ---------- Login ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(38, 173, 217, .16), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(38, 173, 217, .12), transparent 40%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border-radius: 14px; box-shadow: 0 10px 40px rgba(16, 42, 67, .12); padding: 34px 34px 28px; }
.auth-card.wide { max-width: 640px; }
.auth-card .logo { width: 220px; display: block; margin: 0 auto 6px; }
.auth-card .product { text-align: center; color: var(--muted); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; margin-bottom: 26px; }
.auth-card h1 { font-size: 1.25rem; text-align: center; margin-bottom: 18px; }
.auth-footer { margin-top: 20px; display: flex; justify-content: center; gap: 6px; }
.lang-switch button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 3px 9px; cursor: pointer; color: var(--muted); font: inherit; font-size: .85rem; }
.lang-switch button.current { border-color: var(--border); color: var(--text); font-weight: 600; }

/* ---------- Pagination / filter ---------- */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 160px; }
.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 14px; }
.details { font-family: var(--mono); font-size: .8rem; color: var(--muted); max-width: 380px; word-break: break-word; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav .section { width: 100%; }
  .main { padding: 20px 16px 40px; }
  .setup, .form-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .no-print { display: none !important; }
  .layout { display: block; }
}

/* ---------- Utilities ---------- */
.grid.split { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.grid.single { grid-template-columns: minmax(0, 760px); }
.mt { margin-top: 16px; }
.center { text-align: center; }
@media (max-width: 900px) { .grid.split { grid-template-columns: 1fr; } }
.card-head { padding: 16px 22px 4px; }

/* ---------- Aufgaben ---------- */
.card-head.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 12px; }
.card-head.row h2 { margin: 0; }
.form-grid.cols-url { grid-template-columns: 130px 1fr; }
.form-grid.cols-3 { grid-template-columns: 2fr 1fr 1fr; }
textarea.mono, input.mono { font-family: var(--mono); font-size: .88rem; }
ul.plain { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; }
ul.hints { padding-left: 18px; margin: 0; display: grid; gap: 6px; color: var(--muted); }
pre.example { background: #0f1b26; color: #d7e7f3; border-radius: 8px; padding: 12px 14px; font-family: var(--mono); font-size: .8rem; overflow-x: auto; margin: 6px 0 12px; white-space: pre-wrap; word-break: break-word; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { font-weight: 600; }
dl.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.param-table td { padding: 6px 8px; }
.param-table input[type=text], .param-table select, .param-table textarea { padding: 6px 8px; }
.param-table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }
.result { border-left: 4px solid var(--border); }
.result.ok { border-left-color: var(--ok); }
.result.failed { border-left-color: var(--danger); }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.result-head h2 { margin: 0; }
.result p { margin-top: 8px; }
ul.changes { list-style: none; padding: 0; margin: 8px 0; font-family: var(--mono); font-size: .88rem; display: grid; gap: 2px; }
ul.changes li { padding: 3px 10px; border-radius: 6px; }
ul.changes .add { background: var(--ok-soft); color: var(--ok); }
ul.changes .remove { background: var(--danger-soft); color: var(--danger); }
ul.changes .update { background: var(--warn-soft); color: var(--warn); }
ul.changes .same { color: var(--muted); }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; font-size: .9rem; }
.icon-btn[disabled] { opacity: .3; cursor: default; }
tr.muted td { color: var(--muted); }
.switch-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.switch-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 900px) { .form-grid.cols-url, .form-grid.cols-3 { grid-template-columns: 1fr; } }
pre.inline-json { margin: 0; font-family: var(--mono); font-size: .82rem; white-space: pre-wrap; word-break: break-word; }
.card-foot { padding: 10px 22px 16px; margin: 0; }

/* ---------- Pruefungen ---------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); vertical-align: middle; }
.dot.ok { background: var(--ok); }
.dot.danger { background: var(--danger); }
ul.rules { list-style: none; margin: 4px 0 0; padding: 0; font-size: .85rem; display: grid; gap: 2px; }
ul.rules li::before { content: "• "; color: var(--brand); }
.card-head p { margin: 2px 0 0; }

/* Datei-Upload im Stil der übrigen Felder */
input[type=file] { width: 100%; font: inherit; color: var(--text); border: 1px dashed var(--border); border-radius: 8px; padding: 8px; background: #fff; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--brand-soft); border-color: var(--brand); }
input[type=file]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(38, 173, 217, .2); }

/* Kriterien einer Pruefung: volle Breite, Wertspalte breit */
.stack > .card { margin-bottom: 20px; }
.rules-table { table-layout: fixed; min-width: 640px; }
.rules-table col.c-subject { width: 20%; }
.rules-table col.c-path { width: 18%; }
.rules-table col.c-op { width: 22%; }
.rules-table col.c-del { width: 80px; }
.rules-table td input[type=text], .rules-table td select { width: 100%; }

/* ---------- Verlaufsgraph (Statusfarben: gut / ernst / kritisch) ---------- */
:root { --status-good: #0ca30c; --status-serious: #ec835a; --status-critical: #d03b3b; }
.card-head.row.flat { padding: 0 0 8px; }
.inline-select { display: flex; align-items: center; gap: 8px; }
.inline-select select { width: auto; min-width: 220px; padding: 6px 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .85rem; margin: 4px 0 10px; color: var(--text); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.swatch.ok, .history-chart .bar.ok { background: var(--status-good); fill: var(--status-good); }
.swatch.warn, .history-chart .bar.warn { background: var(--status-serious); fill: var(--status-serious); }
.swatch.crit, .history-chart .bar.crit { background: var(--status-critical); fill: var(--status-critical); }
.chart-wrap { position: relative; }
.history-chart { width: 100%; height: auto; display: block; }
.history-chart .grid { stroke: #e8edf2; stroke-width: 1; }
.history-chart .baseline { stroke: #c9d3dc; stroke-width: 1; }
.history-chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.history-chart .bar { pointer-events: none; }
.history-chart .hit { fill: transparent; cursor: crosshair; }
.history-chart .hit.active { fill: rgba(16, 42, 67, .06); }
.chart-tip { position: absolute; z-index: 5; max-width: 340px; pointer-events: none; background: #1d2a35; color: #fff;
             font-size: .8rem; line-height: 1.4; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow); }
.chart-totals { margin: 8px 0 0; }
.chart-table { margin-top: 6px; }

/* ---------- Phasen einer Pruefung ---------- */
.grid.phases { align-items: start; }
.phase.phase-active { border-color: #9fd9ee; box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.phase-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.phase-head h2 { margin: 0; }
.phase-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.phase-section { margin-top: 12px; }
.probe { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.probe-head { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; }
.probe-no { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--muted); }
.probe-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.criteria { padding: 8px 12px 10px 46px; border-top: 1px solid var(--border); }
.criteria.failure { background: #fff7f3; }
.criteria.recovery { background: #f2fbf3; }
.criteria-label { font-size: .75rem; font-weight: 700; margin-bottom: 4px; }
.criteria.failure .criteria-label { color: #a8461f; }
.criteria.recovery .criteria-label { color: var(--ok); }
.criteria ul { margin: 0; padding-left: 18px; font-size: .88rem; }
.phase-then { text-align: center; color: var(--muted); font-size: .85rem; font-weight: 600; margin: 14px 0 10px; }
.phase-action { border-radius: 10px; padding: 12px 14px; border-left: 4px solid; }
.phase-action.danger { background: var(--danger-soft); border-color: var(--status-critical); }
.phase-action.ok { background: var(--ok-soft); border-color: var(--status-good); }
.phase-action .phase-label { margin-bottom: 4px; }
.action-task { margin: 6px 0 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
