/* vdrbs-stats — Oberflaeche.
 *
 * Dunkel, weil das Werkzeug an einem Bildschirm haengt, auf den man beilaeufig
 * schaut; helle Flaechen wuerden dabei blenden. Bewusst eine einzige, fest
 * gewaehlte Erscheinung — keine Umschaltung, kein Ratespiel bei den Farben.
 *
 * Die Reihenfarben sind gegen genau diese Flaeche (#141a20) geprueft: alle
 * Nachbarpaare halten den Abstand fuer Farbfehlsichtigkeit ein, alle liegen
 * ueber 3:1 Kontrast. Wer sie aendert, prueft sie bitte neu.
 */

:root {
  color-scheme: dark;

  --plane: #0b0f13;          /* Seitengrund */
  --surface-1: #141a20;      /* Karten, Diagrammflaeche */
  --surface-2: #19212a;      /* Zeilen, Eingabefelder */
  --surface-3: #202932;      /* Hover */
  --hairline: #232c36;

  --text-primary: #e8eef4;
  --text-secondary: #a3b0bd;
  --text-muted: #6f7d8a;

  --grid: #1e2831;
  --baseline: #2b3742;

  /* Reihenfarben, feste Reihenfolge — nie durchrotieren lassen. */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #9085e9;

  /* Zustandsfarben. Reserviert — nie als sechste Reihenfarbe verwenden. */
  --gut: #0ca30c;
  --warnung: #fab219;
  --ernst: #ec835a;
  --kritisch: #d03b3b;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
a { color: var(--series-1); }

/* ── Kopfzeile ───────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(11, 15, 19, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.marke { font-size: 15px; font-weight: 600; letter-spacing: 0.2px; }
.marke span { color: var(--text-muted); font-weight: 400; }

.reiter { display: flex; gap: 2px; margin-left: 8px; flex-wrap: wrap; }

.reiter button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.reiter button:hover { background: var(--surface-2); color: var(--text-primary); }
.reiter button[aria-selected="true"] {
  background: var(--surface-2);
  border-color: var(--hairline);
  color: var(--text-primary);
}

.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: 12px; }

select, .knopf {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--text-primary);
  font: inherit;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.knopf:hover, select:hover { background: var(--surface-3); }

.puls {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12.5px;
  white-space: nowrap;
}
.puls::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gut);
}
.puls[data-zustand="alt"]::before { background: var(--warnung); }
.puls[data-zustand="tot"]::before { background: var(--kritisch); }

/* ── Grundraster ─────────────────────────────────────────────────────────── */

main { padding: 18px 20px 48px; max-width: 1560px; margin: 0 auto; }
.ansicht[hidden] { display: none; }

.raster { display: grid; gap: 14px; }
.raster.karten { grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }
.raster.zwei { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.raster.kacheln { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.abschnitt { margin-top: 24px; }
.abschnitt-kopf {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 10px;
}
.abschnitt-kopf h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-secondary); }
.abschnitt-kopf .hinweis { color: var(--text-muted); font-size: 12.5px; }

.karte {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ── Kennzahlkacheln ─────────────────────────────────────────────────────── */

.kachel { display: flex; flex-direction: column; gap: 6px; }
.kachel .titel { color: var(--text-secondary); font-size: 12.5px; }
.kachel .wert { font-size: 30px; font-weight: 600; line-height: 1.1; }
.kachel .wert .einheit { font-size: 15px; color: var(--text-secondary); font-weight: 400; margin-left: 3px; }
.kachel .neben { color: var(--text-muted); font-size: 12.5px; }
.kachel .spark { height: 34px; margin-top: 2px; }

/* ── App-Karten ──────────────────────────────────────────────────────────── */

.app-karte { display: flex; flex-direction: column; gap: 10px; }
.app-kopf { display: flex; align-items: flex-start; gap: 10px; }
.app-kopf .name { font-size: 15px; font-weight: 600; }
.app-kopf .host { color: var(--text-muted); font-size: 12.5px; word-break: break-all; }
.app-farbe { width: 3px; align-self: stretch; border-radius: 2px; }

.zustand {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  white-space: nowrap;
}
.zustand .zeichen { font-size: 11px; line-height: 1; }
.zustand[data-zustand="gut"] { color: var(--gut); }
.zustand[data-zustand="warnung"] { color: var(--warnung); }
.zustand[data-zustand="stoerung"] { color: var(--kritisch); }
.zustand[data-zustand="unbekannt"] { color: var(--text-muted); }

.app-werte { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.app-werte div { display: flex; flex-direction: column; }
.app-werte .k { color: var(--text-muted); font-size: 11.5px; }
.app-werte .v { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ── Tabellen ────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 500; color: var(--text-muted);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 6px 10px; border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
td { padding: 7px 10px; border-bottom: 1px solid var(--hairline); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.klickbar { cursor: pointer; }
tbody tr.klickbar:hover { background: var(--surface-2); }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
td.pfad { font-family: var(--mono); font-size: 12px; word-break: break-all; }

.tabellen-karte { padding: 4px 4px 6px; overflow-x: auto; }

/* ── Diagramme ───────────────────────────────────────────────────────────── */

.diagramm-karte { display: flex; flex-direction: column; gap: 8px; }
.diagramm-kopf { display: flex; align-items: baseline; gap: 10px; }
.diagramm-kopf h3 { font-size: 13px; font-weight: 600; }
.diagramm-kopf .beschreibung { color: var(--text-muted); font-size: 12px; }
.diagramm { position: relative; }

.chart-grid { stroke: var(--grid); stroke-width: 1; }
.chart-baseline { stroke: var(--baseline); stroke-width: 1; }
.chart-cursor { stroke: var(--baseline); stroke-width: 1; }
.chart-tick { fill: var(--text-muted); font-size: 10.5px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart-endlabel { fill: var(--text-secondary); font-size: 11px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart-leer { fill: var(--text-muted); font-size: 12px; font-family: var(--sans); }
.chart-hit { cursor: crosshair; }

.chart-tip {
  position: absolute;
  min-width: 160px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.tip-kopf { color: var(--text-muted); margin-bottom: 4px; }
.tip-zeile { display: flex; align-items: center; gap: 6px; }
.tip-name { color: var(--text-secondary); }
.tip-wert { margin-left: auto; font-variant-numeric: tabular-nums; }

.punkt { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }

.legende { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-secondary); }
.legende-eintrag { display: inline-flex; align-items: center; gap: 6px; }

/* ── Verfuegbarkeitsstreifen ─────────────────────────────────────────────── */

.strip { display: flex; gap: 2px; align-items: stretch; height: 26px; }
.strip-zelle { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: var(--surface-3); }
.strip-zelle[data-zustand="gut"] { background: var(--gut); }
.strip-zelle[data-zustand="warnung"] { background: var(--warnung); }
.strip-zelle[data-zustand="ernst"] { background: var(--ernst); }
.strip-zelle[data-zustand="kritisch"] { background: var(--kritisch); }
.strip-zelle[data-zustand="leer"] { background: var(--surface-3); }

.strip-zeile { display: grid; grid-template-columns: 180px 1fr 92px; gap: 12px; align-items: center; padding: 7px 0; }
.strip-zeile + .strip-zeile { border-top: 1px solid var(--hairline); }
.strip-zeile .name { font-size: 13px; }
.strip-zeile .quote { text-align: right; font-variant-numeric: tabular-nums; }

.stapel { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; }
.stapel span { display: block; border-radius: 2px; }

/* ── Hinweise ────────────────────────────────────────────────────────────── */

.hinweis-karte {
  border-left: 3px solid var(--warnung);
  background: var(--surface-1);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hinweis-karte h3 { font-size: 14px; }
.hinweis-karte p { margin: 0; color: var(--text-secondary); }
.hinweis-karte code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-2); padding: 1px 5px; border-radius: 4px;
}

.leer { color: var(--text-muted); font-size: 12.5px; }

/* ── Detailbereich Container ─────────────────────────────────────────────── */

.detail { margin-top: 14px; display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.protokoll {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all;
  max-height: 320px; overflow: auto; color: var(--text-secondary);
  background: var(--surface-2); border-radius: 8px; padding: 10px;
}

/* ── Anmeldung ───────────────────────────────────────────────────────────── */

.anmeldung {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.anmeldung form {
  width: min(360px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 26px;
  display: flex; flex-direction: column; gap: 14px;
}
.anmeldung h1 { font-size: 17px; }
.anmeldung p { margin: 0; color: var(--text-muted); font-size: 12.5px; }
.anmeldung label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-secondary); }
.anmeldung input {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text-primary);
  font: inherit;
}
.anmeldung input:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.anmeldung button {
  background: var(--series-1); border: none; border-radius: 8px;
  padding: 10px; color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.anmeldung button:hover { filter: brightness(1.08); }
.fehler {
  color: var(--kritisch); font-size: 12.5px;
  display: flex; align-items: center; gap: 6px;
}

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .strip-zeile { grid-template-columns: 120px 1fr 76px; }
  .topbar { flex-wrap: wrap; }
}
