:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #75746f;
  --accent: #2a78d6;
  --accent-text: #1f63b5;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --grid: #e8e7e3;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #33332f;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --text-3: #9a998f;
    --accent: #3987e5;
    --accent-text: #7fb2f0;
    --grid: #2a2a27;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand { font-weight: 650; text-decoration: none; color: var(--text); }
.brand span { font-weight: 400; color: var(--text-2); }
.session { display: flex; gap: 12px; align-items: center; color: var(--text-2); font-size: 14px; min-width: 0; }
.session span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.login { max-width: 420px; margin: 48px auto; }
.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
input[type="email"], input[type="search"] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { padding: 9px 14px; border-radius: 8px; border: 0; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.btn[disabled] { opacity: .6; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); margin-top: 12px; }
.error { color: var(--critical); }

.breadcrumb { font-size: 14px; margin-bottom: 8px; }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { font-size: 13px; color: var(--text-2); }
.tile .value { font-size: 28px; font-weight: 600; margin-top: 2px; }

/* Filter */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 14px; }
.filters .search { flex: 1 1 220px; max-width: 320px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px;
  font-size: 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }

/* Projektliste */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.project { display: block; text-decoration: none; color: inherit; }
.project:hover { border-color: var(--text-3); }
.project .head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.project .name { font-weight: 600; overflow-wrap: anywhere; }
.project .url { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.facts strong { color: var(--text); font-weight: 600; }

/* Status: nie nur Farbe — immer Symbol und Wort */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.status.good::before { background: var(--good); }
.status.warning::before { background: var(--warning); border-radius: 2px; }
.status.serious::before { background: var(--serious); border-radius: 2px; }
.status.critical::before { background: var(--critical); border-radius: 0; transform: rotate(45deg); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0; overflow-x: auto; }
.tabs a {
  padding: 8px 12px; text-decoration: none; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

/* Tabellen */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--text-2); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
dl.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 8px 16px; margin: 0; }
dl.kv dt { color: var(--text-2); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Diagramm */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .down { fill: var(--critical); }
.chart .crosshair { stroke: var(--text-3); stroke-width: 1; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.tooltip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.tooltip strong { display: block; font-size: 14px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.legend .key-line { display: inline-block; width: 14px; height: 2px; background: var(--accent); vertical-align: middle; margin-right: 6px; }
.legend .key-down { display: inline-block; width: 8px; height: 8px; background: var(--critical); vertical-align: middle; margin-right: 6px; }

@media (max-width: 560px) {
  .tile .value { font-size: 24px; }
  .brand span { display: none; }
  /* Alle Bereiche sichtbar statt versteckt im Seitwärts-Scrollen. */
  .tabs { flex-wrap: wrap; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
}
