/* Ordinale Blau-Rampe: die Status sind geordnete Stufen, nicht gleichrangige
   Kategorien - je weiter fortgeschritten, desto dunkler (hell im Dunkelmodus).
   --stage-rest ist grau und kennzeichnet Status ausserhalb der Pipeline. */
:root {
  color-scheme: light;
  --surface-0: #f4f3f0; --surface-1: #fcfcfb; --surface-2: #eeece6;
  --border: #dedcd5;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #77756e;
  --accent: #2a78d6; --done: #008300; --warn: #b3261e;
  --stage-1: #86b6ef; --stage-2: #5598e7; --stage-3: #2a78d6; --stage-4: #1c5cab;
  --stage-5: #104281; --stage-6: #0d366b; --stage-7: #0a2a53;
  --stage-rest: #c8c6bd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111110; --surface-1: #1a1a19; --surface-2: #232321;
    --border: #383835;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #8e8d84;
    --accent: #3987e5; --done: #3faf3f; --warn: #f2938c;
    --stage-1: #184f95; --stage-2: #256abf; --stage-3: #3987e5; --stage-4: #6da7ec;
    --stage-5: #9ec5f4; --stage-6: #cde2fb; --stage-7: #e8f1fd;
    --stage-rest: #4a4a46;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--surface-0); color: var(--text-primary);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif; padding: 24px 16px 64px; }
.wrap { max-width: 1240px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
.meta { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }
.meta .stale { color: var(--text-muted); }
a { color: var(--accent); }

/* -------------------------------------------------------------- Bedienleiste */
.controls { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-secondary); font-weight: 600; }
.field.grow { flex: 1 1 220px; }
input[type="search"], input[type="text"], select, button {
  font: inherit; color: var(--text-primary); background: var(--surface-0);
  border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; }
input[type="search"] { width: 100%; }
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { cursor: progress; color: var(--text-muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); color: #fff; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--text-secondary); cursor: pointer; }

/* Statusfilter: Farbpunkt plus Klartext - nie Farbe allein. */
.stage-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.stage-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px 4px 10px; cursor: pointer; color: var(--text-secondary); }
.stage-toggle[aria-pressed="true"] { color: var(--text-primary); border-color: var(--text-muted); }
.stage-toggle[aria-pressed="false"] { opacity: 0.55; text-decoration: line-through; }
.stage-toggle b { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ------------------------------------------------------------------ Kennzahlen */
.kpis { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.kpi { flex: 1 1 150px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12px; color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.04em; }

.panel { background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-secondary); margin: 0 0 10px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px;
  color: var(--text-secondary); margin-top: 10px; }
.legend b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px; }

/* --------------------------------------------------------------------- Tabelle */
table { width: 100%; border-collapse: collapse; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-secondary); font-weight: 600; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }
th.sortable .arrow { opacity: 0; }
th.sortable[aria-sort] .arrow { opacity: 1; }
tbody tr:last-child td { border-bottom: none; }
.bar { display: flex; gap: 2px; height: 10px; }
.bar.big { height: 16px; }
.bar span { border-radius: 2px; }
.bar span:first-child { border-radius: 4px 2px 2px 4px; }
.bar span:last-child { border-radius: 2px 4px 4px 2px; }
.inactive { font-size: 11px; color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.project { white-space: nowrap; }
/* Ohne Versionsspalte nimmt die Produktspalte den freien Platz, mit ihr
   traegt sie nur ihren Inhalt und die Versionsspalte den Rest. */
td.products, td.versions { width: 100%; }
table.with-versions td.products { width: auto; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px;
  margin-right: 7px; vertical-align: 0; flex: none; }
/* Eine Zeile je Produkt und Version, untereinander. Produkt- und
   Versionsspalte fuehren dieselbe Liste - nowrap haelt jede Zeile einzeilig,
   damit die beiden Spalten zeilenweise nebeneinander stehen bleiben. */
.chips { display: flex; flex-direction: column; gap: 2px; }
.chip { font-size: 12.5px; white-space: nowrap; }
.chip .x { color: var(--text-muted); }
.chip .ver { font-variant-numeric: tabular-nums; }
.chip .ver.none { color: var(--text-muted); }
.chip .check { color: var(--done); font-weight: 700; margin-left: 4px; }

details { margin-top: 24px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; }
summary { cursor: pointer; font-weight: 600; }
.sub { color: var(--text-secondary); font-size: 13px; }
.empty { padding: 24px; text-align: center; color: var(--text-secondary);
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; }
.error { border-color: var(--warn); color: var(--warn); white-space: pre-wrap;
  text-align: left; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px; }
.busy { opacity: 0.45; transition: opacity 0.15s; }

/* ------------------------------------------------- Modales Fenster (Versionen)
   <dialog> bringt Fokusfalle, Escape und Abdunklung selbst mit - deshalb kein
   nachgebauter Overlay. Die Farben kommen wie ueberall aus den Variablen,
   damit der Dunkelmodus ohne Zutun stimmt. */
dialog { max-width: 720px; width: calc(100% - 32px); max-height: 82vh; padding: 0;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden; }
dialog:not([open]) { display: none; }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dialog-head h2 { font-size: 15px; margin: 0; flex: 1; }
button.icon { border: none; background: none; font-size: 20px; line-height: 1;
  padding: 2px 6px; color: var(--text-secondary); }
.dialog-body { padding: 16px; overflow: auto; }
.dialog-body table { border: none; border-radius: 0; }
.dialog-body th, .dialog-body td { padding: 7px 10px; }
.dialog-body td.host { color: var(--text-secondary); font-size: 12.5px; }
.dialog-body .sub { font-size: 11.5px; }
.dialog-body details { margin-top: 16px; }
.dialog-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  font-size: 12px; flex-wrap: wrap; }
.dialog-foot .spacer { flex: 1; }
/* Ein Wert, der kein v0.x-Tag ist: Farbe *und* Zeichen, nie Farbe allein. */
.dialog-body a.odd { color: var(--warn); }
.flag { color: var(--warn); }

@media (max-width: 860px) {
  body { padding: 16px 12px 48px; }
  td.project { white-space: normal; }
  /* Produkt- und Versionsspalte bleiben einzeilig, damit sie nebeneinander
     ausgerichtet bleiben - auf schmalen Fenstern scrollt deshalb die Tabelle,
     nicht die Seite. */
  #table { overflow-x: auto; }
}
