/**
 * KOS KLIMA KI-Portal – Bericht des Liquiditätsmonitors.
 *
 * Gilt an zwei Stellen: im Portal (eingebettet in den Wizard) und im eigenständigen
 * Druckdokument (liquiditaet-bericht.php bettet diese Datei ein). Deshalb hängt nichts
 * von den Portal-Variablen ab; alle Farben stehen als eigene Variablen am Bericht
 * (KOS-KLIMA-CI). Alle Klassen tragen das Präfix lqm-.
 *
 * Schmale Bildschirme: Tabellen und Diagramme scrollen waagerecht in ihrem Rahmen, die
 * Seite selbst nie. Druck: A4, je Abschnitt eine neue Seite, Farben bleiben erhalten.
 */

.lqm-bericht {
  --lqm-dunkelblau: #375374;
  --lqm-hellblau: #6CADC6;
  --lqm-beige: #D9CFCA;
  --lqm-hellgrau: #F2F2F2;
  --lqm-linie: #dde1e6;
  --lqm-text: #3c4452;
  --lqm-grau: #5f6673;
  --lqm-rot: #DC3535;
  --lqm-rot-hell: #FFEBEB;
  --lqm-gelb: #FFF6D8;
  --lqm-gruen: #3A8F5A;
  --lqm-gelb-punkt: #E8B92F;

  color: var(--lqm-text);
  font-size: 14px;
  line-height: 1.5;
  max-width: 1120px;
  margin: 0 auto;
}
.lqm-bericht * { box-sizing: border-box; }

/* ---------- Kopf ---------- */
.lqm-kopf {
  background: var(--lqm-dunkelblau);
  color: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.lqm-logo { background: #fff; border-radius: 6px; padding: 7px 12px; display: flex; }
.lqm-logo img { height: 30px; width: auto; display: block; }
.lqm-kopf-titel { text-align: right; margin-left: auto; }
.lqm-kopf-titel h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
}
.lqm-kopf-titel div { font-size: 13px; opacity: .92; margin-top: 2px; }

/* ---------- Abschnitte ---------- */
.lqm-abschnitt { margin-top: 30px; }
.lqm-abschnitt h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--lqm-dunkelblau);
  border-bottom: 2px solid var(--lqm-dunkelblau);
  padding-bottom: 6px;
  margin: 0 0 12px;
}
.lqm-abschnitt h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--lqm-hellblau);
  margin: 20px 0 6px;
}
.lqm-abschnitt p { margin: 8px 0; }
.lqm-fussnote { font-size: 12px; color: var(--lqm-grau); }
.lqm-leer { color: var(--lqm-grau); font-style: italic; }
.lqm-liste { padding-left: 20px; margin: 6px 0; }
.lqm-liste li { margin-bottom: 4px; }
.lqm-freitext {
  background: var(--lqm-hellgrau);
  border-left: 3px solid var(--lqm-hellblau);
  padding: 10px 14px;
  border-radius: 4px;
}

/* ---------- Tabellen ---------- */
.lqm-tabelle {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0 14px;
  border: 1px solid var(--lqm-linie);
  border-radius: 6px;
}
.lqm-tabelle table { border-collapse: collapse; width: 100%; font-size: 13px; }
.lqm-tabelle th, .lqm-tabelle td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--lqm-linie);
  text-align: left;
  vertical-align: top;
}
.lqm-tabelle thead th {
  background: var(--lqm-dunkelblau);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.lqm-tabelle tbody tr:nth-child(even) td { background: #f8f9fa; }
.lqm-tabelle tbody tr:last-child td { border-bottom: 0; }
.lqm-tabelle .lqm-zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Kennung und Datum (erste Spalten) nicht umbrechen – „Tag 1", „25.10.2025" */
.lqm-tabelle td:nth-child(-n+2) { white-space: nowrap; }
.lqm-tabelle .lqm-mitte { text-align: center; }
.lqm-tabelle tr.lqm-ampel-rot td { background: var(--lqm-rot); color: #fff; font-weight: 600; }
.lqm-tabelle tr.lqm-ampel-gelb td { background: var(--lqm-gelb); }
.lqm-tabelle tr.lqm-ueberfaellig td { background: var(--lqm-rot-hell); }

.lqm-ampel {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, .12);
}
.lqm-ampel span {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.lqm-ampel-punkt-gruen { background: var(--lqm-gruen); }
.lqm-ampel-punkt-gelb  { background: var(--lqm-gelb-punkt); }
.lqm-ampel-punkt-rot   { background: var(--lqm-rot); border-color: #fff; }

/* ---------- Kennzahlen ---------- */
.lqm-kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.lqm-kachel {
  background: var(--lqm-hellgrau);
  border-left: 4px solid var(--lqm-dunkelblau);
  border-radius: 4px;
  padding: 9px 12px;
}
.lqm-kachel-betont { border-left-color: var(--lqm-hellblau); background: #eaf4f8; }
.lqm-kachel-titel { font-size: 12px; color: var(--lqm-grau); }
.lqm-kachel-wert { font-size: 17px; font-weight: 700; color: var(--lqm-dunkelblau); white-space: nowrap; }

.lqm-status {
  border: 2px solid var(--lqm-dunkelblau);
  background: var(--lqm-hellgrau);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 8px 0;
}
.lqm-status div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; padding: 4px 0; }
.lqm-status div + div { border-top: 1px solid var(--lqm-linie); }
.lqm-status dt { margin: 0; }
.lqm-status dd { margin: 0; font-weight: 700; text-align: right; }

.lqm-warnung {
  background: var(--lqm-rot);
  color: #fff;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.lqm-hinweisband {
  background: var(--lqm-gelb);
  border-left: 4px solid var(--lqm-gelb-punkt);
  padding: 10px 14px;
  margin: 0 auto 14px;
  max-width: 1120px;
  border-radius: 4px;
}
.lqm-hinweisgruppe { margin-bottom: 14px; }
.lqm-marke {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eaf4f8;
  color: var(--lqm-dunkelblau);
}

/* ---------- Diagramme ---------- */
.lqm-diagramm { margin: 10px 0 6px; }
.lqm-diagramm-flaeche { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lqm-diagramm svg { display: block; width: 100%; min-width: 620px; height: auto; font-family: inherit; }
.lqm-raster { stroke: #e7e9ec; stroke-width: 1; }
.lqm-achsenlinie { stroke: #9aa1ab; stroke-width: 1; }
.lqm-achse { font-size: 12px; fill: var(--lqm-grau); }
.lqm-achsentitel { font-size: 12px; fill: var(--lqm-grau); font-weight: 600; }
.lqm-kategorie { font-size: 11px; fill: var(--lqm-grau); }
.lqm-trenner { stroke: var(--lqm-grau); stroke-width: 1; stroke-dasharray: 2 4; }
.lqm-bezug { stroke-width: 1.5; stroke-dasharray: 7 5; }
.lqm-linie { stroke-width: 3; stroke-linecap: round; fill: none; }
.lqm-punkt { stroke: #fff; stroke-width: 1.5; }

.lqm-legende { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--lqm-grau); margin-top: 6px; }
.lqm-legende-eintrag { display: inline-flex; align-items: center; gap: 6px; }
.lqm-legende-balken { width: 12px; height: 12px; border-radius: 2px; background: var(--lqm-farbe); }
.lqm-legende-linie { width: 18px; height: 3px; border-radius: 2px; background: var(--lqm-farbe); }
.lqm-legende-bezug { width: 18px; border-top: 2px dashed var(--lqm-farbe); }

/* ---------- Fuß ---------- */
.lqm-fuss {
  margin-top: 34px;
  background: var(--lqm-beige);
  color: var(--lqm-text);
  border-radius: 6px;
  padding: 9px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  font-size: 12px;
}

/* ---------- eigenständiges Dokument ---------- */
body.lqm-dokument {
  margin: 0;
  padding: 18px 16px 30px;
  background: #fff;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.lqm-fehlerseite {
  max-width: 560px;
  margin: 40px auto;
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  color: #3c4452;
}
.lqm-fehlerseite h1 { color: #375374; font-size: 19px; }

/* ---------- schmale Bildschirme ---------- */
@media (max-width: 640px) {
  .lqm-bericht { font-size: 13.5px; }
  .lqm-kopf { padding: 14px; }
  .lqm-kopf-titel { text-align: left; margin-left: 0; }
  .lqm-kopf-titel h1 { font-size: 17px; }
  .lqm-kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .lqm-kachel { padding: 8px 10px; }
  .lqm-kachel-wert { font-size: 14.5px; white-space: normal; overflow-wrap: anywhere; }
  .lqm-status dd { text-align: left; }
  .lqm-abschnitt h2 { font-size: 15px; }
}

/* ---------- Druck ---------- */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body.lqm-dokument { padding: 0; }
  .lqm-bericht { max-width: none; font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lqm-abschnitt { break-before: page; margin-top: 0; }
  .lqm-abschnitt:first-of-type { break-before: auto; margin-top: 18px; }
  .lqm-abschnitt h2, .lqm-abschnitt h3 { break-after: avoid; }
  .lqm-tabelle { overflow: visible; border: 0; }
  .lqm-tabelle table { font-size: 8.5pt; }
  .lqm-tabelle th, .lqm-tabelle td { padding: 3px 5px; }
  .lqm-tabelle thead th { position: static; }
  .lqm-tabelle tr { break-inside: avoid; }
  .lqm-diagramm-flaeche { overflow: visible; }
  .lqm-diagramm svg { min-width: 0; }
  .lqm-kacheln, .lqm-status, .lqm-diagramm { break-inside: avoid; }
}
