/**
 * KOS KLIMA KI-Portal – Werkzeug "Liquiditätsmonitor" (Wizard).
 *
 * Nutzt die Farb- und Formvariablen des Portals (:root in index.html), damit der Wizard
 * wie ein Teil des Portals wirkt. Der Bericht selbst ist in liquiditaet-bericht.css
 * gestaltet, weil er auch als eigenständiges Druckdokument ausgeliefert wird.
 *
 * Der Wizard ist der Scrollbereich des Hauptinhalts (main.content ist fixiert), damit
 * lange Schritte und der Bericht auf allen Bildschirmgrößen vollständig erreichbar sind.
 */

.liq-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 24px 60px;
}
.liq-inner { max-width: 1120px; margin: 0 auto; }
/* „hidden" muss auch gegen display: grid/flex der Bausteine gewinnen */
.liq-wrap [hidden] { display: none !important; }
.liq-inner.liq-schmal { max-width: 760px; }

.liq-busy { cursor: progress; }
.liq-busy .liq-wrap button, .liq-busy .liq-wrap input, .liq-busy .liq-wrap a { pointer-events: none; }
.liq-busy .liq-card { opacity: .7; }

/* ---------- Kopf und Schrittleiste ---------- */
.liq-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.liq-kopf-titel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.liq-kopf-titel strong { font-size: 17px; color: var(--navy); }
.liq-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--accent-dark);
}

/* Breite Bildschirme: Schritte umbrechen; schmale: eine waagerecht scrollbare Zeile */
.liq-schritte {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 2px 10px;
  margin-bottom: 8px;
}
.liq-schritt {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 5px 12px 5px 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.liq-schritt:hover:not(:disabled) { border-color: var(--accent); color: var(--navy); }
.liq-schritt:disabled { opacity: .45; cursor: not-allowed; }
.liq-schritt-nr {
  width: 24px; height: 24px; flex: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gray-100);
  color: var(--navy);
  font-size: 12px;
}
.liq-schritt.is-erledigt .liq-schritt-nr { background: var(--accent); color: var(--white); }
.liq-schritt.is-aktiv { border-color: var(--navy); background: var(--navy); color: var(--white); }
.liq-schritt.is-aktiv .liq-schritt-nr { background: var(--white); color: var(--navy); }

/* ---------- Karte ---------- */
.liq-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  transition: opacity .15s;
}
.liq-card-kopf { margin-bottom: 10px; }
.liq-schrittnr { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--accent-dark); }
.liq-card h2 { font-size: 20px; font-weight: 600; color: var(--navy); margin-top: 2px; }
.liq-card h3 { font-size: 15px; font-weight: 600; color: var(--navy); margin: 24px 0 6px; }
.liq-card p { line-height: 1.55; margin-bottom: 12px; color: var(--gray-600); }
.liq-hint { font-size: 12.5px; color: var(--gray-400); line-height: 1.5; }
.liq-card p.liq-hint { color: var(--gray-400); }
.liq-optional { font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .5px; margin-left: 6px; }
.liq-leer { font-size: 13px; color: var(--gray-400); font-style: italic; margin: 4px 0 10px; }

.liq-start { text-align: center; }
.liq-start-icon { font-size: 42px; margin-bottom: 6px; }
.liq-start .liq-hint { max-width: 560px; margin: 0 auto 8px; }
.liq-letzte { margin-top: 24px; text-align: left; border-top: 1px solid var(--gray-100); padding-top: 16px; }
.liq-lauf-knopf {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; margin-top: 6px; padding: 10px 12px;
  background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--navy); text-align: left;
}
.liq-lauf-knopf:hover { border-color: var(--accent); background: var(--accent-light); }

.liq-warten { display: flex; align-items: center; gap: 12px; color: var(--gray-600); }
.liq-spinner {
  width: 18px; height: 18px; flex: none;
  border: 2px solid var(--gray-200); border-top-color: var(--accent);
  border-radius: 50%;
  animation: liq-dreh .8s linear infinite;
}
@keyframes liq-dreh { to { transform: rotate(360deg); } }

/* ---------- Felder ---------- */
.liq-felder {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0 14px;
}
.liq-feld { margin-bottom: 14px; min-width: 0; }
.liq-feld label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--gray-600);
  margin-bottom: 5px;
}
.liq-feld input, .liq-feld textarea, .liq-feld select {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  outline: none;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.liq-feld input[inputmode="decimal"] { text-align: right; font-variant-numeric: tabular-nums; }
.liq-feld input:focus, .liq-feld textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.liq-feld textarea { resize: vertical; line-height: 1.5; }
.liq-feld .liq-hint { margin-top: 4px; }
.liq-check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13.5px; color: var(--gray-800);
  margin: 4px 0 12px; cursor: pointer; line-height: 1.4;
}
.liq-check input { margin-top: 2px; accent-color: var(--accent-dark); flex: none; }

/* ---------- Dateien ---------- */
.liq-datei { margin: 14px 0 18px; }
.liq-datei.liq-laedt { opacity: .6; }
.liq-datei-titel { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-600); margin-bottom: 6px; }
.liq-dropzone {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 20px 14px; margin-bottom: 6px;
  border: 2px dashed var(--gray-300); border-radius: var(--radius);
  background: var(--gray-50); color: var(--gray-600); font-size: 14px;
  transition: border-color .15s, background .15s;
}
.liq-dropzone:hover, .liq-dropzone.is-ziel { border-color: var(--accent); background: var(--accent-light); color: var(--accent-dark); }
.liq-dropzone-icon { font-size: 20px; }
.liq-datei-vorhanden {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  border: 1px solid #bfe5d6; background: #eefaf5; border-radius: var(--radius); padding: 12px 14px;
}
.liq-datei-ok {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--success); color: var(--white); font-weight: 700;
}
.liq-datei-name { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.liq-datei-name strong { color: var(--navy); overflow-wrap: anywhere; }
.liq-datei-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Eingabelisten ---------- */
.liq-liste { margin-bottom: 8px; }
.liq-zeile {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  padding: 10px 14px 4px;
  margin-bottom: 10px;
}
.liq-zeile-kopf {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 8px;
}
.liq-zeile-weg {
  border: none; background: none; color: var(--gray-400);
  font-size: 15px; line-height: 1; padding: 4px 6px; border-radius: 4px;
}
.liq-zeile-weg:hover { color: var(--danger); background: #fdf1f1; }
.liq-unterliste { border-top: 1px dashed var(--gray-300); padding-top: 10px; margin-bottom: 10px; }
.liq-unterliste .liq-zeile { background: var(--white); }
.liq-zeile-neu { margin-bottom: 6px; }

/* ---------- Fixkosten-Stammdaten ---------- */
.liq-fk-kopf {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  margin: 14px 0 8px;
}
.liq-fk-kopf strong { color: var(--navy); margin-right: 8px; }
.liq-fk-tabelle { max-height: 460px; overflow: auto; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); }
.liq-fk-tabelle thead th { position: sticky; top: 0; background: var(--white); z-index: 1; }
.liq-tabelle .liq-zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Kompakte Liste: viele gleichartige Positionen, je Zeile möglichst eine Bildschirmzeile */
.liq-liste-kompakt .liq-zeile { padding: 8px 12px 0; margin-bottom: 8px; }
.liq-liste-kompakt .liq-zeile-kopf { margin-bottom: 4px; }
.liq-liste-kompakt .liq-felder { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; }
.liq-liste-kompakt .liq-feld { margin-bottom: 10px; }
.liq-liste-kompakt .liq-feld input { padding: 7px 9px; font-size: 13.5px; }
.liq-feld-breit { grid-column: span 2; }

/* ---------- Kontostände ---------- */
.liq-banken { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.liq-bank {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 16px 4px;
  min-width: 0;
}
.liq-bank legend {
  padding: 0 6px;
  font-weight: 600;
  color: var(--navy);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.liq-befristung { border-left: 3px solid var(--accent-light); padding-left: 10px; }
.liq-bank-frei { font-size: 13px; font-weight: 600; color: var(--success); margin: -4px 0 10px; min-height: 1.2em; }
.liq-bank-frei.is-negativ { color: var(--danger); }

/* ---------- Hinweise und Status ---------- */
.liq-hinweis {
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 11px 14px;
  margin: 12px 0;
  font-size: 13.5px;
  line-height: 1.5;
}
.liq-hinweis ul, .liq-fehler ul { padding-left: 18px; margin-top: 4px; }
.liq-hinweis-warn { background: #fdf6ec; border-color: var(--warning); color: #7a4d0b; }
.liq-hinweis-fehler, .liq-fehler { background: #fdf1f1; border-color: var(--danger); color: #9b2423; }
.liq-fehler {
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin: 16px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
}
.liq-pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  background: var(--gray-100);
  color: var(--gray-600);
  white-space: nowrap;
}
.liq-pill-ok { background: #e7f6f0; color: var(--success); }
.liq-pill-warn { background: #fdf6ec; color: #7a4d0b; }

.liq-tabelle { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 6px 0 12px; }
.liq-tabelle table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.liq-tabelle th, .liq-tabelle td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.liq-tabelle thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--gray-400); }
.liq-tabelle tbody th { width: 34%; min-width: 150px; color: var(--gray-600); font-weight: 600; }
.liq-klaerung { list-style: none; padding: 0; }
.liq-klaerung li { padding: 6px 0; border-bottom: 1px solid var(--gray-100); font-size: 13.5px; line-height: 1.45; color: var(--gray-800); }

/* ---------- Aktionen ---------- */
.liq-aktionen { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.liq-aktionen.liq-mitte { justify-content: center; }
.liq-navigation { justify-content: space-between; border-top: 1px solid var(--gray-100); padding-top: 18px; }

/* ---------- Bericht im Portal ---------- */
.liq-berichtleiste {
  position: sticky; top: -24px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--gray-50);
  padding: 8px 0 10px;
  margin-bottom: 8px;
}
.liq-berichtleiste-abstand { flex: 1; }
.liq-berichtleiste a.btn { text-decoration: none; }
.liq-berichtflaeche {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ---------- schmale Bildschirme ---------- */
@media (max-width: 860px) {
  .liq-wrap { padding: 16px 12px 50px; }
  .liq-card { padding: 18px 16px; }
  .liq-berichtflaeche { padding: 12px; }
  .liq-berichtleiste { top: -16px; }
  /* Schrittleiste: nur Nummern, der Titel steht in der Karte */
  .liq-schritte { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .liq-schritt { flex: 0 0 auto; padding: 4px; }
  .liq-schritt-titel { display: none; }
  .liq-schritt.is-aktiv { padding-right: 12px; }
  .liq-schritt.is-aktiv .liq-schritt-titel { display: inline; }
  .liq-banken { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .liq-navigation .btn { flex: 1 1 auto; justify-content: center; }
  .liq-berichtleiste .btn { flex: 1 1 auto; justify-content: center; }
  .liq-berichtleiste-abstand { display: none; }
  .liq-card h2 { font-size: 18px; }
  .liq-feld-breit { grid-column: auto; }
}
