/* Farb- und Formensprache bewusst identisch zum AV-Rechner und zum
   Signalflow-Konfigurator, damit die eigenen Tools als eine Familie erkennbar
   bleiben. */
:root {
  --bg: #f4f5f7;
  --flaeche: #ffffff;
  --flaeche-2: #f8f9fb;
  --rand: #d6d9de;
  --rand-stark: #b3b8c0;
  --text: #1f2328;
  --leise: #6b727c;
  --primaer: #2f6fb5;
  --primaer-text: #ffffff;
  --gefahr: #c0392b;
  --ok-bg: #eef6ee;
  --ok-rand: #7fae7f;
  --warn-bg: #fdf3e3;
  --warn-rand: #e0b054;
  --fehler-bg: #fdecea;
  --fehler-rand: #d9534f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1d21;
    --flaeche: #24272c;
    --flaeche-2: #1f2226;
    --rand: #3a3f46;
    --rand-stark: #50565e;
    --text: #e6e8ea;
    --leise: #9aa1aa;
    --primaer: #4b8fd6;
    --ok-bg: #21301f;
    --ok-rand: #4d7a4d;
    --warn-bg: #3a2f1c;
    --warn-rand: #8a6b2a;
    --fehler-bg: #3a2320;
    --fehler-rand: #a4453f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

.versteckt { display: none !important; }
.luecke { flex: 1; }

/* ---------- Kopf ---------- */
.kopf {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--rand);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.kopf h1 { font-size: 17px; margin: 0; font-weight: 600; white-space: nowrap; }
.kopf .projektname { flex: 0 1 260px; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--rand-stark);
  border-radius: 6px;
  padding: 6px 8px;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--primaer); outline-offset: -1px; }
input[type="checkbox"], input[type="radio"] { min-width: auto; }
input[type="range"] { padding: 0; }

button, .knopf-link {
  font: inherit;
  background: var(--flaeche);
  color: var(--text);
  border: 1px solid var(--rand-stark);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover, .knopf-link:hover { border-color: var(--primaer); }
button:disabled { opacity: 0.5; cursor: default; }
button.klein { padding: 4px 9px; font-size: 13px; }
button.primaer { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); }

/* ---------- Arbeitsfläche ---------- */
.arbeitsflaeche {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 0;
  height: calc(100vh - 53px);
}
.steuerung {
  overflow-y: auto;
  border-right: 1px solid var(--rand);
  background: var(--flaeche-2);
  padding: 12px;
}
.buehne {
  overflow: auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

@media (max-width: 900px) {
  .arbeitsflaeche { grid-template-columns: minmax(0, 1fr); height: auto; }
  .steuerung { border-right: none; border-bottom: 1px solid var(--rand); }
}

/* ---------- Gruppen ---------- */
.gruppe {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.gruppe > summary {
  cursor: pointer;
  padding: 8px 12px;
  font-weight: 600;
  background: var(--flaeche-2);
  border-bottom: 1px solid transparent;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gruppe > summary::-webkit-details-marker { display: none; }
.gruppe > summary::before { content: "▸"; color: var(--leise); }
.gruppe[open] > summary { border-bottom-color: var(--rand); }
.gruppe[open] > summary::before { content: "▾"; }
.gruppe .inhalt { padding: 10px 12px 12px; }

.zeile { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.zeile > label { flex: 0 0 auto; color: var(--leise); font-size: 13px; }
.zeile input[type="number"] { width: 92px; }
.zeile input[type="text"] { flex: 1 1 140px; }
.zeile select { flex: 1 1 140px; }
.paar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.paar label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--leise); }
.drei { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.drei label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--leise); }
.hinweis { font-size: 12px; color: var(--leise); margin: 4px 0 0; }
.warnung {
  font-size: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-rand);
  border-radius: 6px;
  padding: 6px 8px;
  margin: 6px 0 0;
}
.fehler {
  font-size: 12px;
  background: var(--fehler-bg);
  border: 1px solid var(--fehler-rand);
  border-radius: 6px;
  padding: 6px 8px;
  margin: 6px 0 0;
}

/* ---------- Schirmliste ---------- */
.schirmliste { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.schirm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--rand);
  border-radius: 6px;
  background: var(--flaeche);
  cursor: pointer;
}
.schirm.aktiv { border-color: var(--primaer); box-shadow: inset 0 0 0 1px var(--primaer); }
.schirm .name { font-weight: 600; }
.schirm .daten { font-size: 12px; color: var(--leise); }
.schirm input[type="checkbox"] { margin: 0; }
.schirm .kopfzeile { flex: 1; min-width: 0; }
.schirm .kopfzeile > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Bildwahl ---------- */
.bildwahl { display: flex; flex-wrap: wrap; gap: 6px; }
.bildwahl button {
  font-size: 13px;
  padding: 5px 10px;
}
.bildwahl button.aktiv { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); }
.bildwahl label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  border: 1px solid var(--rand);
  border-radius: 6px;
  padding: 4px 8px;
  background: var(--flaeche);
  cursor: pointer;
}

/* ---------- Vorschau ---------- */
.vorschau-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vorschau-rahmen {
  border: 1px solid var(--rand);
  border-radius: 8px;
  background:
    repeating-conic-gradient(var(--flaeche-2) 0% 25%, var(--flaeche) 0% 50%) 50% / 20px 20px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 240px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}
.vorschau-rahmen.einpassen { align-items: center; justify-content: center; padding: 8px; }
#vorschau {
  display: block;
  image-rendering: pixelated;
  /* Der Schatten macht ein reinweißes Testbild vor hellem Hintergrund sichtbar. */
  box-shadow: 0 0 0 1px var(--rand-stark);
}
.beschreibung { font-size: 13px; color: var(--leise); margin: 0; }

.werte {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--leise);
}
.werte .probe {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--rand-stark);
  display: inline-block;
  vertical-align: middle;
}

.fortschritt {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: 6px;
  padding: 8px 10px;
}
.fortschritt .balken {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--flaeche-2);
  border: 1px solid var(--rand);
  overflow: hidden;
}
.fortschritt .balken i { display: block; height: 100%; background: var(--primaer); width: 0; }
