:root {
  --blau: #1d4e89; --blau-hell: #eaf1fa; --rand: #d6dde6; --text: #1c2530;
  --gruen: #1e7f4f; --rot: #b3362c; --grau: #6b7684; --hintergrund: #f5f7fa;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text); background: var(--hintergrund); font-size: 14px;
}
a { color: var(--blau); text-decoration: none; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 24px 0 8px; }

.kopf {
  display: flex; align-items: center; gap: 16px; padding: 8px 16px;
  background: var(--blau); color: #fff; flex-wrap: wrap;
}
.kopf a { color: #dce7f5; padding: 4px 6px; border-radius: 4px; }
.kopf a:hover, .kopf a.aktiv { background: rgba(255,255,255,.15); color: #fff; }
.marke { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.marke svg { color: #fff; flex-shrink: 0; }
.mandant-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.mandant-name { font-weight: 600; margin-right: 8px; color: #fff; }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.benutzer-name { color: #cdd9ea; }

main { padding: 16px; }
.seite { max-width: 1100px; margin: 0 auto; }
.seite-breit { max-width: none; }

.karten { display: flex; gap: 12px; flex-wrap: wrap; }
.karte {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-width: 240px;
  background: #fff; border: 1px solid var(--rand); border-radius: 8px; color: var(--text);
}
.karte:hover { border-color: var(--blau); }
.karte.inaktiv { opacity: .5; }
.karte span { color: var(--grau); font-size: 12px; }
.klein { font-size: 12px; color: var(--grau); }

.login-box {
  max-width: 360px; margin: 10vh auto; background: #fff; padding: 24px;
  border: 1px solid var(--rand); border-radius: 8px;
}
.login-box label, .formular-zeilen label { display: block; margin-bottom: 10px; }
.fehler { color: var(--rot); }

input, select, button, textarea {
  font: inherit; padding: 6px 8px; border: 1px solid var(--rand); border-radius: 4px;
}
input, select, textarea { width: 100%; background: #fff; }
label { font-size: 13px; color: #3a4553; }
label input, label select { margin-top: 2px; }
button {
  background: var(--blau); color: #fff; border: none; cursor: pointer; width: auto;
  padding: 7px 14px;
}
button:hover { filter: brightness(1.1); }
button.sekundaer { background: #fff; color: var(--blau); border: 1px solid var(--blau); }
button.gefahr { background: var(--rot); }

.formular-zeilen {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px; background: #fff; padding: 16px; border: 1px solid var(--rand);
  border-radius: 8px; align-items: end;
}
.formular-zeilen .cb { display: flex; align-items: center; gap: 6px; }
.formular-zeilen .cb input { width: auto; }

table.liste { width: 100%; border-collapse: collapse; background: #fff; }
table.liste th, table.liste td {
  border: 1px solid var(--rand); padding: 5px 8px; text-align: left;
}
table.liste th { background: var(--blau-hell); position: sticky; top: 0; }
table.liste td.zahl, table.liste th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
table.liste input, table.liste select { padding: 3px 5px; }

.werkzeuge {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--rand); border-radius: 8px; padding: 10px 12px;
}
.werkzeuge label { display: flex; align-items: center; gap: 6px; }
.werkzeuge input, .werkzeuge select { width: auto; }
.hinweis { color: var(--grau); font-size: 12px; }
.warnung { color: #8a5a00; background: #fff6e0; border: 1px solid #e8c56b;
  padding: 8px 10px; border-radius: 6px; margin: 8px 0; }
.warnung.gruen { color: #1e5c38; background: #e8f5ec; border-color: #9fd3ae; }

/* ---- Plan-Matrix ---- */
.matrix-huelle {
  overflow: auto; max-height: calc(100vh - 190px); background: #fff;
  border: 1px solid var(--rand); border-radius: 8px;
}
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.matrix th, .matrix td {
  border-right: 1px solid #edf0f4; border-bottom: 1px solid #edf0f4;
  padding: 3px 6px; white-space: nowrap; text-align: right;
  font-variant-numeric: tabular-nums; background: #fff;
}
.matrix thead th { position: sticky; background: var(--blau-hell); z-index: 3; }
.matrix thead tr:nth-child(1) th { top: 0; }
.matrix thead tr:nth-child(2) th { top: 25px; }
.matrix .zeilkopf {
  position: sticky; left: 0; text-align: left; z-index: 2; min-width: 230px; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; border-right: 2px solid var(--rand);
}
.matrix thead .zeilkopf { z-index: 4; }
.matrix tr.gruppe td { background: #f0f4f9; font-weight: 600; cursor: pointer; }
.matrix tr.gruppe td.zeilkopf::before { content: "▾ "; color: var(--grau); }
.matrix tr.gruppe.zu td.zeilkopf::before { content: "▸ "; }
.matrix tr.summe td { background: #e8eef6; font-weight: 700; border-top: 2px solid var(--rand); }
.matrix tr.bestand td { background: #f6f2e8; }
.matrix tr.bestand.gesamt td { font-weight: 700; }
.matrix td.we { background: #f7f8fa; }
.matrix td.heute-spalte { background: #fdf3d7 !important; }
.matrix th.heute-spalte { background: #f5d98a; }
.matrix td.negativ { color: var(--rot); font-weight: 600; }
.matrix td.positiv { color: var(--gruen); }
.matrix td.ist-wert { text-decoration: underline dotted #9db4d0; text-underline-offset: 2px; }
/* Ansicht „mit Vortrag“: vorgetragene Dauerschuld-Zahlungen; schraffiert, wenn
   am selben Tag auch eine reguläre Planbuchung auf dem Konto liegt */
.matrix td.vortrag, .legende-muster.vortrag { background: #fbe3b9 !important; }
.matrix td.vortrag-schraffiert, .legende-muster.vortrag-schraffiert {
  background: repeating-linear-gradient(135deg, #fbe3b9 0 5px, #eeb764 5px 7px) !important;
}
.legende-muster {
  display: inline-block; width: 14px; height: 11px; margin-right: 5px;
  vertical-align: -1px; border: 1px solid #e0b46a; border-radius: 2px;
}
.vortrag-liste { margin: 4px 0 0 18px; padding: 0; }
.matrix .konto-nr { color: var(--grau); margin-right: 4px; }
/* Kontozellen öffnen den Zellendialog; manuell verschobene Beträge mit Eckmarke */
.matrix td.klickbar { cursor: pointer; }
.matrix td.klickbar:hover { outline: 2px solid #9db4d0; outline-offset: -2px; }
.matrix td.verschoben, .legende-muster.verschoben-muster { position: relative; }
.matrix td.verschoben::after, .legende-muster.verschoben-muster::after {
  content: ""; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-top: 7px solid #eb6834; border-left: 7px solid transparent;
}
.legende-muster.verschoben-muster { border-color: var(--rand); background: #fff; }

.zellen-dialog {
  border: 1px solid #c9d4e0; border-radius: 8px; padding: 16px 20px;
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
}
.zellen-dialog::backdrop { background: rgba(20, 35, 55, .35); }
.zd-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.zd-kopf h3 { margin: 0 0 2px; }
.zd-abschnitt { border-top: 1px solid var(--rand); margin-top: 12px; padding-top: 10px; }
.zd-abschnitt h4 { margin: 0 0 8px; font-size: 14px; }
.zd-abschnitt table.liste { width: 100%; }
.zd-abschnitt td.zahl, .zd-abschnitt th.zahl { text-align: right; white-space: nowrap; }
.zd-konto { display: inline-flex; align-items: center; gap: 4px; }
.zd-konto .badge-konto {
  display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 12px;
  background: #e8f5ec; color: #1e5c38; border: 1px solid #9fd3ae; white-space: nowrap;
}
.zd-konto button.loesen {
  border: none; background: none; color: #1e5c38; cursor: pointer; font-weight: 700; padding: 0 2px;
}
.zd-formular { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.zd-formular label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.zd-formular .quellen { display: flex; gap: 14px; align-items: center; }
.zd-formular .quellen label { flex-direction: row; gap: 5px; align-items: center; }
.zd-liste { margin: 0; padding: 0; list-style: none; }
.zd-liste li {
  display: flex; gap: 10px; align-items: baseline; padding: 4px 0;
  border-bottom: 1px solid #edf0f4; font-size: 12.5px;
}
.zd-liste li .abgelaufen { color: var(--grau); font-style: italic; }
.zd-liste li button { margin-left: auto; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--grau); }

#toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 99;
  display: flex; flex-direction: column; gap: 8px;
}
#toast .meldung {
  background: #223041; color: #fff; padding: 10px 14px; border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); max-width: 420px;
}
#toast .meldung.fehler { background: var(--rot); }

a.knopf {
  display: inline-block; padding: 7px 14px; border-radius: 4px; background: #fff;
  color: var(--blau); border: 1px solid var(--blau);
}
a.knopf:hover { background: var(--blau-hell); }

.badge-gesperrt {
  background: #fbe9e7; color: var(--rot); border: 1px solid #e6b3ad;
  border-radius: 4px; padding: 1px 6px; font-size: 11px; white-space: nowrap;
}

.tab-leiste { display: flex; gap: 4px; margin-bottom: 12px; }
.tab-leiste button { background: #fff; color: var(--text); border: 1px solid var(--rand); }
.tab-leiste button.aktiv { background: var(--blau); color: #fff; border-color: var(--blau); }

/* Browser ohne <dialog>-Unterstützung: geschlossene Dialoge nie anzeigen */
dialog:not([open]) { display: none; }

/* Onboarding-Wizard: Schrittleiste */
.wizard-schritte {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none;
  padding: 0; margin: 0 0 18px;
}
.wizard-schritte li {
  padding: 5px 11px; border: 1px solid var(--rand); border-radius: 16px;
  background: #fff; font-size: 12.5px; color: #6b7686;
}
.wizard-schritte li.aktiv {
  background: var(--blau); border-color: var(--blau); color: #fff; font-weight: 600;
}
.wizard-schritte li.fertig { background: #e8f5ec; border-color: #9fd3ae; color: #1e5c38; }
.wizard-schritt h2 { margin-top: 0; }
.wizard-schritt { background: #fff; border: 1px solid var(--rand); border-radius: 8px; padding: 18px 20px; }
.wizard-knoepfe { display: flex; gap: 10px; margin-top: 14px; align-items: center; }

/* Fixierte erste Spalte (z. B. Kontenbezeichnung in der Budgetplanung) */
table.liste td.fix-spalte, table.liste th.fix-spalte {
  position: sticky; left: 0; background: #fff; z-index: 2;
  box-shadow: 2px 0 0 var(--rand);
}
table.liste thead th.fix-spalte { background: var(--blau-hell); z-index: 5; }

/* Budgetplanung im Plan-Layout */
.budget-matrix td.erfasst { font-weight: 700; color: var(--text); }
.budget-matrix td.fortgeschrieben { font-style: italic; color: var(--grau); }
.budget-matrix td.abweichend { position: relative; }
.budget-matrix td.abweichend::after {
  content: ""; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-top: 7px solid #eb6834; border-left: 7px solid transparent;
}
.bd-zeile { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: baseline; margin: 8px 0; }
.bd-label { font-size: 12.5px; color: var(--grau); }
.bd-optionen { display: flex; flex-direction: column; gap: 5px; }
.bd-optionen label { display: flex; gap: 7px; align-items: baseline; font-size: 13px; }
.bd-optionen input[type="radio"], .bd-optionen input[type="checkbox"] {
  width: auto; flex: 0 0 auto; margin: 0; position: relative; top: 1px;
}
.bd-optionen .hinweis { font-size: 12px; }
.bd-optionen .hinweis { margin: 0; }
#bd-wirksam { font-size: 12.5px; line-height: 1.55; }
button.gefahr-text { color: var(--rot); border-color: #e6b3ad; }

/* Durchsuchbare Kontoauswahl mit Kategorie-Überschriften (PDF-Abstimmung) */
.kombo { position: relative; display: inline-block; min-width: 250px; }
.kombo input { width: 100%; }
.kombo-liste {
  position: absolute; top: 100%; left: 0; right: 0; max-height: 300px; overflow-y: auto;
  background: #fff; border: 1px solid var(--rand); border-radius: 4px; z-index: 30;
  box-shadow: 0 6px 18px rgba(20, 40, 70, .18);
}
.kombo-gruppe {
  padding: 4px 9px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: #46525f; background: var(--blau-hell); border-top: 1px solid var(--rand);
  position: sticky; top: 0;
}
.kombo-liste > .kombo-gruppe:first-child { border-top: none; }
.kombo-eintrag {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: inherit; padding: 5px 9px; cursor: pointer; font-size: 12.5px; border-radius: 0;
}
.kombo-eintrag:hover, .kombo-eintrag.markiert { background: #eaf1fa; }
.kombo-eintrag.gewaehlt { font-weight: 600; }
.kombo-eintrag.kombo-leer-eintrag { color: var(--grau); font-style: italic; }
.konto-feld .kombo { display: block; min-width: 220px; }
.kombo-eintrag .konto-nr { color: var(--grau); margin-right: 5px; }
.sammel-vermerk {
  display: inline-block; margin-top: 3px; padding: 0 6px; border-radius: 8px;
  background: var(--blau-hell); color: #1d4e89; font-size: 11px;
}
.kombo-leer { padding: 7px 9px; color: #8a93a0; font-size: 12px; }

/* ---- KPI-Seite ---- */
.kpi-seite.laedt .kpi-kacheln, .kpi-seite.laedt .kpi-raster { opacity: .55; transition: opacity .15s; }
.kpi-kacheln {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px; margin: 14px 0 6px;
}
.kpi-kachel { background: #fff; border: 1px solid var(--rand); border-radius: 8px; padding: 12px 14px; }
.kpi-kachel-label { font-size: 12.5px; color: #52514e; }
.kpi-kachel-wert { font-size: 22px; font-weight: 600; margin: 4px 0 2px; color: var(--text); }
.kpi-kachel-zeile { font-size: 12px; color: #52514e; margin-top: 2px; }
.kpi-kachel-zeile.gut { color: #006300; }
.kpi-kachel-zeile.schlecht { color: var(--rot); }
.kpi-status {
  display: inline-block; font-size: 12px; font-weight: 600; margin: 2px 0;
  padding: 1px 8px; border-radius: 10px;
}
.status-kritisch .kpi-status { background: #fbe4e4; color: #a32a2a; }
.status-gut .kpi-status { background: #e3f4e3; color: #006300; }
.kpi-raster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.kpi-karte {
  margin: 0; background: #fff; border: 1px solid var(--rand); border-radius: 8px;
  padding: 12px 14px; min-width: 0;
}
.kpi-karte.breit { grid-column: 1 / -1; }
.kpi-karte-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.kpi-karte h3 { font-size: 14px; margin: 0; }
.kpi-untertitel { font-size: 12px; color: var(--grau); margin-top: 2px; }
.klein-knopf { padding: 3px 9px; font-size: 12px; }
.dg-legende { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: #52514e; margin: 8px 0 2px; }
.dg-legende > span { display: inline-flex; align-items: center; gap: 6px; }
.dg-schluessel { display: inline-block; flex-shrink: 0; }
.dg-schluessel.flaeche { width: 10px; height: 10px; border-radius: 2px; }
.dg-schluessel.linie { width: 14px; height: 2px; border-radius: 1px; }
.dg-plot { margin-top: 6px; width: 100%; }
.dg-plot svg { display: block; overflow: visible; }
.dg-ziffern { font-variant-numeric: tabular-nums; }
.dg-marke { transition: opacity .1s; }
.dg-marke.aktiv { opacity: .78; }
.dg-tooltip {
  position: fixed; z-index: 50; display: none; pointer-events: none; background: #fff;
  border: 1px solid rgba(11, 11, 11, .12); border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
  padding: 7px 10px; font-size: 12px; min-width: 150px;
}
.dg-tooltip-titel { color: #52514e; margin-bottom: 4px; }
.dg-tooltip-zeile { display: flex; align-items: center; gap: 7px; margin-top: 2px; }
.dg-tooltip-zeile strong { color: var(--text); font-variant-numeric: tabular-nums; }
.dg-tooltip-name { color: #52514e; }
.dg-tabelle { margin-top: 8px; max-height: 340px; overflow: auto; }
.dg-leer { padding: 24px; color: var(--grau); text-align: center; }
.kpi-tabelle-huelle { overflow-x: auto; margin-top: 8px; }
.liste td.negativ { color: var(--rot); }
.liste td.positiv { color: var(--gruen); }
@media (max-width: 1000px) { .kpi-raster { grid-template-columns: minmax(0, 1fr); } }

/* ---- Bestellungen & Bestellfreigabe ---- */
.status-badge {
  display: inline-block; border: 1px solid; border-radius: 4px; padding: 0 6px;
  font-size: 11px; line-height: 1.6; white-space: nowrap; vertical-align: 1px;
}
.status-badge.offen { background: #fff6e0; color: #8a5a00; border-color: #e8c56b; }
.status-badge.freigegeben { background: #e8f5ec; color: #1e5c38; border-color: #9fd3ae; }
.status-badge.abgelehnt { background: #fbe9e7; color: var(--rot); border-color: #e6b3ad; }
.status-badge.abgeloest { background: #eaf1fa; color: #1d4e89; border-color: #9db4d0; }
.status-badge.storniert { background: #f0f2f5; color: var(--grau); border-color: var(--rand); }
.status-badge.neutral { background: #f5f7fa; color: #46525f; border-color: var(--rand); }
/* von der KI vorbelegte Felder (Klasse verschwindet beim Bearbeiten) */
.ki-vorschlag { background: #fdf3d7 !important; border-color: #e8c56b !important; }
.ki-legende { display: inline-block; width: 12px; height: 10px; margin-right: 4px; vertical-align: -1px;
  background: #fdf3d7; border: 1px solid #e8c56b; border-radius: 2px; }

/* Auswahldialoge: SharePoint-Ordner, lokaler Ordner, Datei aus der Ablage */
.sp-dialog { width: min(780px, calc(100vw - 32px)); }
.sp-abschnitt h4 { display: flex; align-items: center; gap: 8px; }
.sp-nr {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 20px; height: 20px; border-radius: 50%; background: var(--blau); color: #fff; font-size: 12px;
}
.sp-abschnitt.inaktiv { opacity: .55; }
.sp-abschnitt.inaktiv .sp-nr { background: var(--grau); }
.sp-zeile { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.sp-zeile input { flex: 1 1 260px; width: auto; }
.sp-liste {
  list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto;
  border: 1px solid var(--rand); border-radius: 6px; background: #fff;
}
.sp-liste li {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  border-bottom: 1px solid #edf0f4; cursor: pointer; font-size: 13px;
}
.sp-liste li:last-child { border-bottom: none; }
.sp-liste li:hover { background: #f5f8fc; }
.sp-liste li.gewaehlt { background: var(--blau-hell); box-shadow: inset 3px 0 0 var(--blau); }
.sp-liste li.gewaehlt .sp-name { font-weight: 600; }
.sp-liste li.sp-leer { cursor: default; color: var(--grau); font-size: 12.5px; }
.sp-liste li.sp-leer:hover { background: none; }
.sp-liste li.sp-aktuell { background: #f7f9fc; }
.sp-liste li.sp-aktuell.gewaehlt { background: var(--blau-hell); }
.sp-liste .sp-symbol { flex: 0 0 auto; width: 18px; text-align: center; }
.sp-liste .sp-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-liste .sp-name .klein { display: block; overflow: hidden; text-overflow: ellipsis; }
.sp-liste .sp-info { flex: 0 0 auto; font-size: 12px; color: var(--grau); white-space: nowrap; }
.sp-liste li button { flex: 0 0 auto; }
.sp-pfad { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 12.5px; margin-bottom: 6px; }
.sp-pfad button {
  background: none; border: none; color: var(--blau); padding: 1px 3px; border-radius: 3px; font-size: 12.5px;
}
.sp-pfad button:hover { background: var(--blau-hell); filter: none; }
.sp-pfad .sp-trenner { color: var(--grau); padding: 0 2px; }
.sp-pfad .sp-hier { font-weight: 600; padding: 1px 3px; }
.sp-fuss {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--rand); margin-top: 12px; padding-top: 10px;
}
.sp-gewaehlt { margin-right: auto; font-size: 12.5px; min-width: 0; overflow-wrap: anywhere; }
.sp-id { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--grau); overflow-wrap: anywhere; }

/* Bestellungen: Liste und Erfassungsdialog */
.bs-ablage-ziel { overflow-wrap: anywhere; }
/* Dateiauswahl unsichtbar, aber nicht display:none (Safari: programmatischer Klick) */
.bs-datei-eingabe { position: absolute; width: 1px !important; height: 1px; padding: 0; opacity: 0; overflow: hidden; pointer-events: none; }
#bereich-liste.ziehen-ueber { outline: 2px dashed var(--blau); outline-offset: 4px; border-radius: 8px; }
.bs-erfassung {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr);
  gap: 16px; margin-top: 12px; align-items: start;
}
@media (max-width: 900px) { .bs-erfassung { grid-template-columns: minmax(0, 1fr); } }
.bs-vorschau {
  border: 1px solid var(--rand); border-radius: 6px; background: #f7f8fa;
  display: flex; flex-direction: column; min-height: 300px;
}
.bs-vorschau-kopf {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 10px;
  border-bottom: 1px solid var(--rand); font-size: 12.5px; background: #fff; border-radius: 6px 6px 0 0;
}
.bs-vorschau-kopf .sp-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.bs-vorschau iframe { display: block; width: 100%; height: clamp(320px, calc(100vh - 330px), 760px); border: 0; background: #fff; }
.bs-vorschau-leer { padding: 28px 16px; color: var(--grau); text-align: center; font-size: 13px; }
.bs-textauszug {
  margin: 0; padding: 8px 10px; max-height: 260px; overflow: auto; white-space: pre-wrap;
  font-size: 11.5px; background: #fff; border-top: 1px solid var(--rand);
}
.bs-formular label { display: block; margin-bottom: 8px; }
.bs-formular textarea { resize: vertical; }
.bs-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 10px; }
.bs-wert {
  margin-top: 2px; padding: 6px 8px; min-height: 33px; border: 1px dashed var(--rand); border-radius: 4px;
  background: #f7f8fa; font-variant-numeric: tabular-nums; font-weight: 600;
}
.bs-formular .hinweis { display: block; margin-top: 2px; }
.bs-fuss { margin: 12px 0 0; justify-content: flex-end; }
/* Erfassungsdialog: Knöpfe bleiben beim Blättern sichtbar */
#erfassung-dialog > .bs-fuss { position: sticky; bottom: 0; z-index: 5; box-shadow: 0 -6px 12px -8px rgba(20, 35, 55, .25); }
.bs-fuss .bs-fuss-links { margin-right: auto; }
.bs-ki-box { font-size: 12.5px; }
.bs-ki-box ul { margin: 4px 0 0 18px; padding: 0; }
.bs-aktionen { white-space: nowrap; }
.bs-aktionen button { margin: 1px 0; }
table.liste tr.bs-zu td { color: #7d8794; }

/* Bestellfreigabe: Rechenweg, Ampel */
.bf-kopf { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin-top: 10px; }
.bf-kopf .bf-label { display: block; font-size: 11.5px; color: var(--grau); }
.bf-kopf .bf-wert { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bf-steuer { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.bf-steuer label { display: flex; align-items: center; gap: 6px; }
.bf-steuer select { width: auto; max-width: 100%; }
table.bf-tabelle td, table.bf-tabelle th { padding: 4px 8px; }
table.bf-tabelle th.zahl, table.bf-tabelle td.zahl { width: 150px; white-space: nowrap; }
table.bf-tabelle tr.bf-davon td { color: var(--grau); font-style: italic; font-size: 12px; }
table.bf-tabelle tr.bf-zwischen td { font-weight: 600; background: #f7f9fc; }
table.bf-tabelle tr.bf-summe td { font-weight: 700; background: #eef3f9; border-top: 2px solid #b9c7d8; }
table.bf-tabelle tr.bf-ergebnis td { font-weight: 700; background: #eef3f9; border-top: 2px solid #b9c7d8; }
table.bf-tabelle td.bf-massgeblich { background: #fff8e1; }
table.bf-tabelle tr.bf-summe td.bf-massgeblich, table.bf-tabelle tr.bf-ergebnis td.bf-massgeblich { background: #fdf0c4; }
table.bf-tabelle th.bf-massgeblich { background: #f5d98a; }
table.bf-tabelle td.negativ { color: var(--rot); font-weight: 700; }
table.bf-tabelle .bf-erl { display: block; font-size: 11px; color: var(--grau); font-weight: 400; font-style: normal; }
.bf-ampel {
  display: flex; gap: 12px; align-items: center; margin: 10px 0; padding: 10px 12px;
  border: 1px solid; border-radius: 6px; font-size: 14px;
}
.bf-licht { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; }
.bf-ampel.gruen { background: #e8f5ec; border-color: #9fd3ae; color: #1e5c38; }
.bf-ampel.gruen .bf-licht { background: #2e9d5b; box-shadow: 0 0 0 3px #c9ebd5; }
.bf-ampel.rot { background: #fbe9e7; border-color: #e6b3ad; color: #8f2a22; }
.bf-ampel.rot .bf-licht { background: #c8372c; box-shadow: 0 0 0 3px #f3cfcb; }
.bf-ampel.grau { background: #f5f7fa; border-color: var(--rand); color: #46525f; }
.bf-ampel.grau .bf-licht { background: #a5afbb; }
.bf-liquiditaet { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; }
.bf-liquiditaet strong { font-variant-numeric: tabular-nums; }
.bf-hinweise { margin: 6px 0 0 18px; padding: 0; font-size: 12px; color: #52514e; }
.bf-entscheidung textarea { margin-top: 2px; }
.bf-rahmen { max-width: 760px; }
.warnung.rot { color: #8f2a22; background: #fbe9e7; border-color: #e6b3ad; }
