/* dsP-Radar — handgeschrieben, kein Framework, kein CDN. */

:root {
  --navy: #02254d;
  --navy-hell: #0a3d7a;
  --bg: #eef1f8;
  --karte: #fff;
  --rand: #d7deec;
  --text: #1a2233;
  --leise: #6b7690;

  --gut: #0ca30c;
  --warn: #fab219;
  --ernst: #ec835a;
  --krit: #d03b3b;

  --raus-bg: #ffe3e3;
  --raus-fg: #8c1c1c;
  --rein-bg: #dcf5dc;
  --rein-fg: #14631a;

  --kopf-h: 52px;
  --reiter-h: 38px;
  --filter-h: 42px;
}

* { box-sizing: border-box; }

/* Muss vor allen display-Regeln stehen und !important sein: Jede eigene Klasse mit
   'display' (z. B. .bestand-raster { display: grid }) ist spezifischer als das
   [hidden] { display: none } des Browsers und wuerde es sonst aushebeln. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 13.5px/1.5 'Segoe UI', system-ui, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
}

/* --- Kopf --- */

.kopf {
  height: var(--kopf-h);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
}
.kopf h1 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.kopf-mitte { display: flex; align-items: center; gap: 8px; flex: 1; }
.kopf-rechts { display: flex; align-items: center; gap: 12px; }
.kopf .leise { color: #9fb4d4; }

.fortschritt { font-variant-numeric: tabular-nums; color: #cfe0f7; }

select, .knopf {
  font: inherit;
  border-radius: 6px;
  border: 1px solid var(--rand);
  padding: 5px 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
select { max-width: 340px; }
.knopf:hover:not(:disabled) { background: #f2f5fb; }
.knopf:disabled { opacity: .45; cursor: default; }
.knopf-stark {
  background: var(--gut);
  border-color: var(--gut);
  color: #fff;
  font-weight: 600;
}
.knopf-stark:hover:not(:disabled) { background: #0b8f0b; }

.ankreuz { display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; white-space: nowrap; }

/* --- Filter --- */

.filter {
  height: var(--filter-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid var(--rand);
  overflow-x: auto;
  white-space: nowrap;
}
.filter-gruppe { display: flex; align-items: center; gap: 4px; }

.pille {
  border: 1px solid var(--rand);
  background: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--leise);
  white-space: nowrap;
}
.pille:hover { border-color: var(--navy-hell); }
.pille[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  font-weight: 600;
}
.pille .zahl { opacity: .65; margin-left: 4px; font-variant-numeric: tabular-nums; }

.trenner { width: 1px; height: 22px; background: rgba(255,255,255,.22); }

/* --- Reiter --- */

.reiter {
  height: var(--reiter-h);
  display: flex;
  gap: 2px;
  padding: 0 12px;
  background: #fff;
  border-bottom: 1px solid var(--rand);
}
.reiter-knopf {
  font: inherit;
  border: none;
  background: none;
  padding: 0 14px;
  cursor: pointer;
  color: var(--leise);
  border-bottom: 2px solid transparent;
}
.reiter-knopf:hover { color: var(--navy); }
.reiter-knopf.aktiv { color: var(--navy); font-weight: 600; border-bottom-color: var(--navy); }
.reiter-knopf .zahl {
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
  margin-left: 4px;
}
.reiter-knopf .zahl:empty { display: none; }

/* --- Bestand --- */

.bestand { height: calc(100vh - var(--kopf-h) - var(--reiter-h)); overflow-y: auto; padding: 18px; }

.leerzustand {
  max-width: 520px;
  margin: 8vh auto;
  text-align: center;
  background: #fff;
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 34px 28px;
}
.leerzustand h2 { margin: 0 0 10px; color: var(--navy); font-size: 17px; }
.leerzustand p { color: var(--leise); margin: 0 0 18px; line-height: 1.6; }

.bestand-raster {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}
.kachel-breit { grid-column: 1 / -1; }
@media (max-width: 1000px) { .bestand-raster { grid-template-columns: 1fr; } }

.kachel {
  background: #fff;
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 16px 18px;
}
.kachel-kopf { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.kachel h2 { margin: 0 0 4px; font-size: 14px; color: var(--navy); }
.kachel-hilfe { margin: 0; font-size: 12px; color: var(--leise); line-height: 1.55; max-width: 60ch; }
.anzahl {
  font-size: 20px;
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.ablage {
  border: 2px dashed var(--rand);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #fafbfe;
}
.ablage:hover, .ablage:focus-visible { border-color: var(--navy-hell); background: #f2f5fb; outline: none; }
.ablage.drueber { border-color: var(--gut); background: #f0fbf0; }
.ablage strong { color: var(--navy); font-size: 13px; }
.ablage .leise { font-size: 11.5px; }

.dateiliste, .laufliste { list-style: none; margin: 12px 0 0; padding: 0; }
.dateiliste li, .laufliste li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12.5px;
}
.dateiliste li:nth-child(odd), .laufliste li:nth-child(odd) { background: #f7f9fd; }
.dateiliste .name, .laufliste .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dateiliste .groesse { color: var(--leise); font-variant-numeric: tabular-nums; flex: none; }
.dateiliste .weg, .dateiliste .runter, .laufliste .weg {
  border: none;
  background: none;
  color: var(--leise);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 4px;
  flex: none;
}
.dateiliste .weg:hover, .laufliste .weg:hover { color: var(--krit); }
/* Blau statt rot: Herunterladen ist nicht destruktiv, das Rot gehoert dem ✕. */
.dateiliste .runter:hover { color: var(--navy); }
/* .knopf:disabled greift hier nicht — das ist eine andere Klasse. */
.laufliste .weg:disabled { opacity: .35; cursor: default; }
.dateiliste .fehlt { color: var(--leise); font-style: italic; padding: 8px; }

.lauf-leiste { display: flex; align-items: center; gap: 12px; }

/* --- Routing-Bewertung --- */

.routing { margin-top: 16px; border-top: 1px solid var(--rand); padding-top: 12px; }
.routing h3 { margin: 0 0 3px; font-size: 13px; color: var(--navy); }

.routingliste { list-style: none; margin: 10px 0 0; padding: 0; }
.routingliste li {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  border-left: 3px solid transparent;
}
.routingliste li.betroffen { background: #f0f7ff; border-left-color: var(--navy); }
.routingliste li.nicht { background: #f7f9fd; border-left-color: #d7deec; }
.routingliste .zeichen { flex: none; font-weight: 700; color: var(--navy); }
.routingliste li.nicht .zeichen { color: var(--leise); }
.routingliste .dok { font-weight: 600; flex: none; min-width: 12ch; }
.routingliste li.nicht .dok { color: var(--leise); font-weight: 500; }
.routingliste .grund { color: var(--leise); line-height: 1.5; }
.laufliste li { cursor: pointer; }
.laufliste li:hover { background: #eef1f8; }
.laufliste .stand { color: var(--leise); flex: none; }

/* --- Spalten --- */

.spalten {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - var(--kopf-h) - var(--reiter-h) - var(--filter-h));
}
@media (max-width: 1100px) { .spalten { grid-template-columns: 1fr; } }

.links, .rechts { overflow-y: auto; }
.links { border-right: 1px solid var(--rand); background: #fff; }

/*
 * Drei Kinder statt zwei: mit 'justify-content: space-between' verteilten sie sich auf
 * Anfang/Mitte/Ende und der Kopf zerfiele. Stattdessen schiebt der Dateiname als einziges
 * flex:1-Kind den Rest nach rechts — und ellipsiert, statt den Knopf hinauszudruecken.
 */
.links-kopf {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--rand);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}
.links-kopf #dokName { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links-kopf #dokInfo { flex: none; }
.links-kopf #fassungLaden { flex: none; white-space: nowrap; }

.dokument {
  margin: 0;
  padding: 12px 14px;
  font: 12px/1.65 ui-monospace, 'Cascadia Mono', Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}
.dokument .leer { color: var(--leise); font-family: 'Segoe UI', sans-serif; }

.dokument mark {
  background: #fff3b0;
  outline: 2px solid var(--warn);
  border-radius: 2px;
  scroll-margin-top: 60px;
}

/* --- Karten --- */

.rechts { padding: 12px; }
.lade { padding: 20px; color: var(--leise); }

.karte {
  background: var(--karte);
  border: 1px solid var(--rand);
  border-left: 4px solid var(--rand);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  cursor: pointer;
}
.karte:hover { border-color: var(--navy-hell); }
.karte.aktiv {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(2,37,77,.15), 0 2px 10px rgba(0,0,0,.09);
}
.karte.kritisch { border-left-color: var(--krit); }
.karte.hoch     { border-left-color: var(--ernst); }
.karte.mittel   { border-left-color: var(--warn); }
.karte.gering   { border-left-color: #b9c4da; }

.karte.entschieden { opacity: .55; }
.karte.entschieden:hover { opacity: 1; }

.karte-kopf { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }
.karte-titel { font-weight: 600; margin: 3px 0 5px; line-height: 1.35; }
.karte-grund { color: var(--leise); font-size: 12.5px; margin-bottom: 8px; }

.marke {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: #eef1f8;
  color: var(--leise);
}
.marke.kritisch { background: #fbe2e2; color: var(--krit); }
.marke.hoch     { background: #fdece4; color: #a8471f; }
.marke.mittel   { background: #fff4dc; color: #8a6100; }
.marke.dok      { background: var(--navy); color: #fff; }
.marke.llm      { background: #e6dcfa; color: #4b2a94; }

/* --- Diff --- */

.diff {
  font: 12px/1.6 ui-monospace, 'Cascadia Mono', Consolas, monospace;
  background: #fafbfe;
  border: 1px solid var(--rand);
  border-radius: 6px;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 9px;
  max-height: 260px;
  overflow-y: auto;
}
.diff .zeile { display: flex; gap: 7px; }
.diff .zeichen { color: var(--leise); user-select: none; flex: none; }
.diff .raus { background: var(--raus-bg); color: var(--raus-fg); text-decoration: line-through; }
.diff .rein { background: var(--rein-bg); color: var(--rein-fg); }
.diff .nur-raus { color: var(--raus-fg); }
.diff .nur-rein { color: var(--rein-fg); }

.kein-ersatz {
  font-size: 12.5px;
  color: var(--leise);
  background: #fafbfe;
  border: 1px dashed var(--rand);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 9px;
}

/* --- Aktionen --- */

.aktionen { display: flex; gap: 6px; flex-wrap: wrap; }
.aktionen button {
  font: inherit;
  font-size: 12.5px;
  border: 1px solid var(--rand);
  background: #fff;
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
}
.aktionen button:hover:not(:disabled) { background: #f2f5fb; border-color: var(--navy-hell); }
.aktionen button:disabled { opacity: .4; cursor: default; }
.aktionen .a[aria-pressed="true"] { background: var(--gut); border-color: var(--gut); color: #fff; font-weight: 600; }
.aktionen .b[aria-pressed="true"] { background: var(--leise); border-color: var(--leise); color: #fff; font-weight: 600; }
.aktionen .c[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }

.warnung {
  font-size: 12px;
  color: var(--krit);
  background: #fbe2e2;
  border-radius: 5px;
  padding: 4px 8px;
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  font: 12px/1.6 ui-monospace, Consolas, monospace;
  border: 1px solid var(--rand);
  border-radius: 6px;
  padding: 7px 9px;
  resize: vertical;
  min-height: 80px;
  margin: 6px 0;
}
textarea:focus { outline: 2px solid var(--navy-hell); border-color: var(--navy-hell); }

.werkzeug { border-top: 1px dashed var(--rand); margin-top: 9px; padding-top: 8px; }
.werkzeug-titel { font-size: 12px; color: var(--leise); margin-bottom: 2px; }

.marke.rev { background: #e6dcfa; color: #4b2a94; }

.historie { margin-top: 9px; border-top: 1px dotted var(--rand); padding-top: 7px; }
.historie-zeile {
  font-size: 12px;
  color: var(--leise);
  padding: 2px 0 2px 8px;
  border-left: 2px solid var(--rand);
  margin-bottom: 2px;
}
.aktionen .d[aria-pressed="true"] { background: #4b2a94; border-color: #4b2a94; color: #fff; font-weight: 600; }

.leise { color: var(--leise); }
.nichts { padding: 30px 14px; text-align: center; color: var(--leise); }

/* --- Versionsanzeige + Changelog --- */

.version {
  font: inherit;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  background: none;
  border: 1px solid rgba(255,255,255,.25);
  color: #cfe0f7;
  border-radius: 999px;
  padding: 2px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.version:hover { background: rgba(255,255,255,.12); color: #fff; }

.changelog-liste { list-style: none; margin: 4px 0 16px; padding: 0; max-height: 55vh; overflow-y: auto; }
.changelog-liste li {
  display: grid;
  grid-template-columns: 5em 6.5em 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 12.5px;
}
.changelog-liste li:nth-child(odd) { background: #f7f9fd; }
.changelog-liste li.aktuell { background: #f0f7ff; box-shadow: inset 3px 0 0 var(--navy); }
.changelog-liste .nr { font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.changelog-liste .datum { color: var(--leise); font-variant-numeric: tabular-nums; }
.changelog-liste .text { line-height: 1.45; word-break: break-word; }
.changelog-liste .leer { display: block; padding: 10px; color: var(--leise); font-style: italic; }

/* --- Einstellungs-Dialog --- */

.knopf-icon { padding: 5px 9px; font-size: 15px; line-height: 1; }
.knopf-warn { color: var(--krit); border-color: #f0c2c2; }
.knopf-warn:hover:not(:disabled) { background: #fbe2e2; }

.dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: min(620px, 94vw);
  box-shadow: 0 18px 60px rgba(0,0,0,.3);
  color: var(--text);
}
.dialog::backdrop { background: rgba(2,37,77,.42); }

.dialog-inhalt { padding: 20px 22px; }
.dialog-inhalt h2 { margin: 0 0 16px; font-size: 17px; color: var(--navy); }

.feld { margin-bottom: 20px; }
.feld > label { display: block; font-weight: 600; margin-bottom: 5px; }
.feld-zeile { display: flex; gap: 6px; align-items: center; margin-bottom: 5px; }
.feld-zeile > input, .feld-zeile > select { flex: 1; min-width: 0; }

.feld input[type="text"], .feld input[type="password"], .feld select {
  font: inherit;
  padding: 6px 9px;
  border: 1px solid var(--rand);
  border-radius: 6px;
  width: 100%;
  background: #fff;
  color: var(--text);
}
.feld input:focus, .feld select:focus { outline: 2px solid var(--navy-hell); border-color: var(--navy-hell); }
.feld input[type="password"] { font-family: ui-monospace, Consolas, monospace; }

.feld-hilfe { margin: 4px 0 0; font-size: 12px; color: var(--leise); line-height: 1.5; }
.feld-hilfe code, .url {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  background: #eef1f8;
  padding: 1px 4px;
  border-radius: 3px;
}
.feld-hilfe.gut { color: var(--gut); font-weight: 600; }
.feld-hilfe.fehler { color: var(--krit); font-weight: 600; }

.dialog-fuss { font-size: 12px; margin: 0 0 14px; }
.dialog-knoepfe { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--rand); padding-top: 14px; }

/* --- Hinweis --- */

.hinweis {
  position: fixed;
  right: 14px;
  bottom: 14px;
  max-width: 460px;
  background: var(--navy);
  color: #fff;
  padding: 11px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0,0,0,.28);
  white-space: pre-wrap;
  z-index: 10;
}
.hinweis.fehler { background: var(--krit); }
.hinweis.gut { background: var(--gut); }

/* --- Anmeldung ------------------------------------------------------------ */
/*
 * Geometrie wie .leerzustand, aber linksbuendig: dessen 'text-align: center'
 * wuerde die Beschriftungen der Eingabefelder mittig setzen.
 */
.anmeldung {
  max-width: 460px;
  margin: 8vh auto;
  background: #fff;
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 30px 28px;
}
.anmeldung h2 { margin: 0 0 18px; color: var(--navy); font-size: 17px; }
.anmeldung .feld { margin-bottom: 16px; }
.anmeldung input[type="text"], .anmeldung input[type="password"] { width: 100%; }
.anmeldung .dialog-knoepfe { margin-top: 20px; }

/* --- Benutzerverwaltung im Zahnrad ---------------------------------------- */
.benutzerliste .ich { color: var(--leise); font-style: italic; }
