/* Ausguck – schlichtes, responsives Stylesheet (keine externen Abhängigkeiten) */
:root {
  --bg: #f4f6f9; --card: #fff; --text: #1d2733; --muted: #6b7785; --border: #dde3ea;
  --primary: #1f5fa8; --primary-dark: #174a84; --ok: #16a34a; --warn: #d97706; --crit: #dc2626;
  --info: #3b82f6; --maint: #7c3aed; --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 13px; margin: 8px 0; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.container { max-width: 1400px; width: 100%; margin: 0 auto; padding: 20px; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: 11px; padding: 12px; }

/* Kopfzeile */
.topbar { background: #14263d; color: #fff; display: flex; align-items: center; gap: 16px; padding: 0 20px; flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.brand { color: #fff; font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; padding: 12px 0; }
.brand:hover { text-decoration: none; }
.mainnav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.mainnav a, .mainnav .linkbtn { color: #c9d6e6; padding: 16px 10px; display: inline-block; border-bottom: 3px solid transparent; font-size: 14px; }
.mainnav a:hover, .mainnav .linkbtn:hover { color: #fff; text-decoration: none; }
.mainnav a.active { color: #fff; border-bottom-color: #5aa0ef; }
.mainnav .spacer { flex: 1; }
.linkbtn { background: none; border: 0; cursor: pointer; font: inherit; }
.navtoggle, .navburger { display: none; }
form.inline { display: inline; margin: 0; }

/* Karten & Layout */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card.narrow { max-width: 460px; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cardhead h2 { margin: 0; }
.pagehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .grid2, .grid2 + div { margin-top: 16px; }
.danger-zone { border-color: #f3c2c2; }

/* Formulare */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input:not([type]), input[type=password], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3f0; border-color: var(--primary); }
textarea { width: 100%; resize: vertical; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #3a4654; }
label.check { flex-direction: row; align-items: center; gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack input:not([type=checkbox]) { width: 100%; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 200px; }
.row .grow input { width: 100%; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { min-width: 220px; }
.btn { display: inline-block; border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 7px 14px; cursor: pointer; color: var(--text); white-space: nowrap; }
.btn:hover { background: #eef2f6; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: #fff; background: var(--crit); border-color: var(--crit); }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 9px; font-size: 12px; }

/* Meldungen */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; border: 1px solid; }
.flash-ok { background: #ecfdf3; border-color: #a7e3bd; color: #135c31; }
.flash-error { background: #fef2f2; border-color: #f3c2c2; color: #8f1d1d; }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--primary); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; color: var(--text); }
.tile:hover { text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.tile.ok { border-left-color: var(--ok); }
.tile.warn { border-left-color: var(--warn); }
.tile.crit { border-left-color: var(--crit); }
.tile-num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.tile-label { color: var(--muted); font-size: 13px; }

/* Tabellen */
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card .tablewrap { border: 0; border-radius: 0; }
.tablewrap.scroll { max-height: 520px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
.table th { background: #f8fafc; font-weight: 600; font-size: 12px; color: #4b5866; position: sticky; top: 0; white-space: nowrap; }
.table tbody tr:hover { background: #f8fbff; }
.table td.empty { text-align: center; color: var(--muted); padding: 24px; }
.table tr.row-offline td { background: #fff7f7; }
.table tr.muted td { color: var(--muted); }
.table td form { margin: 0; }
.matrix td { white-space: nowrap; }
.ver { display: inline-block; background: #eef3f9; border-radius: 4px; padding: 1px 6px; margin: 1px 2px 1px 0; font-family: var(--mono); font-size: 12px; }
.ver.hit { background: #fde68a; }

/* Status & Badges */
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #c4ccd6; vertical-align: middle; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.dot.maint { box-shadow: 0 0 0 3px #ddd0fb; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #e6eaef; color: #3a4654; white-space: nowrap; }
a.badge:hover { text-decoration: none; filter: brightness(.95); }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.sev-info { background: #dbeafe; color: #1e40af; }
.badge.sev-warning { background: #fef3c7; color: #92400e; }
.badge.sev-critical { background: #fee2e2; color: #991b1b; }
.badge.state-open { background: #fee2e2; color: #991b1b; }
.badge.state-acknowledged { background: #fef3c7; color: #92400e; }
.badge.state-resolved { background: #dcfce7; color: #166534; }
.badge.maint { background: #ede9fe; color: #5b21b6; }
.bar { display: inline-block; width: 60px; height: 8px; background: #e6eaef; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.bar.warn > span { background: var(--warn); }
.bar.crit > span { background: var(--crit); }
.barval { font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* Schlüssel/Wert */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* Diagramme */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart { position: relative; height: 240px; }
.chart canvas { width: 100%; height: 100%; display: block; }
.chart .tip { position: absolute; pointer-events: none; background: rgba(20,38,61,.92); color: #fff; font-size: 12px; padding: 6px 8px; border-radius: 5px; white-space: nowrap; display: none; z-index: 2; }
.chart .legend { position: absolute; top: 0; right: 4px; font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.chart .legend i { display: inline-block; width: 10px; height: 3px; margin-right: 4px; vertical-align: middle; }
.chart .nodata { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.segmented button { border: 0; background: #fff; padding: 5px 12px; cursor: pointer; border-right: 1px solid var(--border); }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--primary); color: #fff; }

/* Sonstiges */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; color: var(--muted); }
.tabs a.active { background: var(--card); border-color: var(--border); color: var(--text); margin-bottom: -1px; }
.copybox { display: flex; gap: 8px; align-items: center; background: #0f1b2b; color: #e5edf7; padding: 10px 12px; border-radius: 6px; margin: 8px 0; }
.copybox code { flex: 1; word-break: break-all; color: inherit; }
.login-wrap { display: flex; align-items: center; justify-content: center; flex: 1; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-title { display: flex; align-items: center; gap: 10px; }

/* Responsiv */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .formgrid { grid-template-columns: 1fr; }
  .navburger { display: block; margin-left: auto; font-size: 22px; cursor: pointer; padding: 8px; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  .navtoggle:checked ~ .mainnav { display: flex; }
  .mainnav a, .mainnav .linkbtn { padding: 8px 4px; border-bottom: 0; text-align: left; }
  .mainnav .spacer { display: none; }
  .container { padding: 12px; }
}
