/**
 * Fin CRM - die Arbeitsflaechen: Pipeline, Listen, Akte, Berichte, Dialoge.
 *
 * Zweite Haelfte von `fincrm-demo.css`, das die Huelle und das Dashboard
 * traegt. Getrennt wurde nicht nach Geschmack, sondern wegen der Groesse:
 * Zusammen lagen die Regeln bei rund 1450 Zeilen und damit weit ueber der
 * Grenze von 800, die dieses Projekt fuer eine Datei setzt.
 *
 * Die Farbtoken stehen in `fincrm-demo.css` auf `.in-fc` - beide Dateien
 * gehoeren zusammen und werden gemeinsam eingebunden.
 */

/* ========================================
   SCHALTFLÄCHEN
   ======================================== */

.in-fc-knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--fc-linie);
  border-radius: 8px;
  background: var(--fc-karte);
  color: var(--fc-schrift);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.in-fc-knopf:hover {
  background: var(--fc-flaeche);
}

.in-fc-knopf:focus-visible {
  outline: 2px solid var(--fc-akzent);
  outline-offset: 2px;
}

.in-fc-knopf--stark {
  background: var(--fc-akzent);
  border-color: var(--fc-akzent);
  color: #ffffff;
}

.in-fc-knopf--stark:hover {
  background: #37474f;
}

.in-fc-knopf--gefahr {
  color: #b91c1c;
  border-color: #f3c4c4;
}

.in-fc-knopf--gefahr:hover {
  background: #fef2f2;
}

.in-fc-knopf[disabled] {
  opacity: 0.6;
  cursor: default;
}

/* ========================================
   MARKEN UND MELDUNGEN
   ======================================== */

.in-fc-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--fc-flaeche);
  color: var(--fc-schrift-leise);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.in-fc-chip--gewonnen { background: #dcfce7; color: #166534; }
.in-fc-chip--verloren { background: #fee2e2; color: #b91c1c; }
.in-fc-chip--inaktiv  { background: #e5e7eb; color: #4b5563; }
.in-fc-chip--europace { background: #e0e7ff; color: #3730a3; }

.in-fc-meldung {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.5;
}

.in-fc-meldung svg {
  flex: 0 0 auto;
  margin-top: 2px;
}

.in-fc-meldung--warnung {
  border: 1px solid #fcd9a8;
  background: #fff8ef;
  color: #7a4a12;
}

.in-fc-meldung--hinweis {
  border: 1px solid var(--fc-linie);
  background: var(--fc-flaeche);
  color: var(--fc-schrift-leise);
}

/* Der Speicherhinweis steht über dem Inhalt und nicht im Kartenraster. */
.in-fc-inhalt > .in-fc-meldung {
  margin: 0 0 16px;
}

.in-fc-leer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 0;
  color: var(--fc-schrift-leise);
  line-height: 1.5;
}

.in-fc-leer strong {
  color: var(--fc-schrift);
}

/* ========================================
   PIPELINE
   ======================================== */

.in-fc-brett {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.in-fc-spalte {
  display: flex;
  flex-direction: column;
  flex: 0 0 280px;
  max-height: calc(100vh - 220px);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  transition: background-color 150ms ease;
}

.in-fc-spalte--ziel {
  background: #e0e7ef;
  outline: 2px dashed var(--fc-akzent);
  outline-offset: -4px;
}

.in-fc-spalte-kopf {
  padding: 12px 14px 8px;
}

.in-fc-spalte-kopf h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.in-fc-spalte-kopf p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--fc-schrift-leise);
}

.in-fc-spalte-liste {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 8px 12px;
  overflow-y: auto;
}

.in-fc-vorhaben {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: var(--fc-karte);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  cursor: grab;
}

.in-fc-vorhaben--zieht {
  opacity: 0.5;
}

.in-fc-vorhaben--verloren {
  opacity: 0.7;
}

.in-fc-karte-titel {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fc-schrift);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.in-fc-karte-titel:hover {
  text-decoration: underline;
}

.in-fc-vorhaben-art,
.in-fc-vorhaben-objekt {
  margin: 0;
  font-size: 12px;
  color: var(--fc-schrift-leise);
}

.in-fc-vorhaben-betrag {
  margin: 0;
  font-weight: 600;
}

.in-fc-vorhaben-fuss {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.in-fc-karte-phase {
  margin-left: auto;
  max-width: 130px;
  min-height: 32px;
  padding: 0 4px;
  border: 1px solid var(--fc-linie);
  border-radius: 6px;
  background: var(--fc-karte);
  color: var(--fc-schrift-leise);
  font: inherit;
  font-size: 12px;
}

/* ========================================
   LISTEN UND TABELLEN
   ======================================== */

.in-fc-listenseite {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.in-fc-listenkopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.in-fc-listenkopf-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.in-fc-zaehler {
  font-size: 13px;
  color: var(--fc-schrift-leise);
}

.in-fc-listensuche {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--fc-linie);
  border-radius: 8px;
  background: var(--fc-karte);
  color: var(--fc-schrift-leise);
}

.in-fc-listensuche input {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--fc-schrift);
}

.in-fc-listensuche input:focus {
  outline: none;
}

/* Waagerecht rollen statt die Seite zu sprengen - schmale Fenster zeigen
   sonst nur die halbe Tabelle und der Rest ist unerreichbar. */
.in-fc-tabellenrahmen {
  overflow-x: auto;
  border-radius: 8px;
  background: var(--fc-karte);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.in-fc-tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.in-fc-tabelle th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--fc-linie);
  color: var(--fc-schrift-leise);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.in-fc-tabelle td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--fc-linie);
  vertical-align: middle;
}

.in-fc-tabelle tbody tr:last-child td {
  border-bottom: 0;
}

.in-fc-tr {
  cursor: pointer;
}

.in-fc-tr:hover {
  background: var(--fc-flaeche);
}

.in-fc-tr:focus-visible {
  outline: 2px solid var(--fc-akzent);
  outline-offset: -2px;
}

.in-fc-tabelle--schlank {
  box-shadow: none;
}

.in-fc-tabelle td > div {
  display: flex;
  flex-direction: column;
}

.in-fc-namenszelle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.in-fc-durchgestrichen {
  text-decoration: line-through;
  color: var(--fc-schrift-leise);
}

.in-fc-haken--an {
  background: #15803d;
  border-color: #15803d;
  color: #ffffff;
}

.in-fc-av--klein {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.in-fc-av--gross {
  width: 52px;
  height: 52px;
  font-size: 16px;
}

.in-fc-zeile-knopf {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.in-fc-zeile-knopf:hover .in-fc-zeile-titel {
  text-decoration: underline;
}

/* ========================================
   KUNDENAKTE
   ======================================== */

.in-fc-akte {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.in-fc-akte-kopf {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.in-fc-zurueck {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--fc-karte);
  color: var(--fc-schrift);
  cursor: pointer;
}

.in-fc-zurueck:hover {
  background: var(--fc-linie);
}

.in-fc-akte-titel h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.in-fc-akte-titel p {
  margin: 2px 0 0;
  color: var(--fc-schrift-leise);
}

.in-fc-akte-knoepfe {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.in-fc-akte-raster {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}

.in-fc-akte-spalte {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.in-fc-datenliste {
  margin: 12px 0 0;
}

.in-fc-datenzeile {
  display: grid;
  grid-template-columns: minmax(120px, 40%) minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--fc-linie);
}

.in-fc-datenzeile:last-child {
  border-bottom: 0;
}

.in-fc-datenzeile dt {
  color: var(--fc-schrift-leise);
}

.in-fc-datenzeile dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ========================================
   BERICHTE
   ======================================== */

.in-fc-berichte {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.in-fc-kennzahlreihe {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.in-fc-kennzahlkachel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
  border-radius: 8px;
  border-left: 5px solid var(--fc-akzent);
  background: var(--fc-karte);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.in-fc-kennzahlkachel-titel {
  font-size: 13px;
  color: var(--fc-schrift-leise);
}

.in-fc-kennzahlkachel strong {
  font-size: 26px;
  font-weight: 400;
}

.in-fc-berichtsraster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

.in-fc-berichtsraster .in-fc-karte,
.in-fc-berichte > .in-fc-karte {
  grid-column: auto;
}

.in-fc-trichter {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 0 8px;
}

.in-fc-trichter-zeile {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr) minmax(110px, auto);
  align-items: center;
  gap: 12px;
}

.in-fc-trichter-label {
  font-size: 13px;
  color: var(--fc-schrift-leise);
}

.in-fc-trichter-bahn {
  height: 22px;
  border-radius: 4px;
  background: var(--fc-flaeche);
  overflow: hidden;
}

.in-fc-trichter-balken {
  height: 100%;
  min-width: 2px;
  border-radius: 4px;
  background: var(--fc-orange);
}

.in-fc-trichter-wert {
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

/* ========================================
   EINSTELLUNGEN UND IMPORT
   ======================================== */

.in-fc-einstellungen {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
}

.in-fc-einstellungen .in-fc-karte {
  grid-column: auto;
}

.in-fc-importblock {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
}

.in-fc-jsonfeld {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--fc-linie);
  border-radius: 8px;
  background: var(--fc-flaeche);
  color: var(--fc-schrift);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.in-fc-importknoepfe {
  display: flex;
  gap: 8px;
}

.in-fc-vorschau {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.in-fc-vorschau:empty {
  display: none;
}

/* ========================================
   SCHMALE FENSTER (Anbau)
   ======================================== */

@media (max-width: 900px) {
  .in-fc-akte-raster {
    grid-template-columns: minmax(0, 1fr);
  }

  .in-fc-formraster {
    grid-template-columns: minmax(0, 1fr);
  }

  .in-fc-trichter-zeile {
    grid-template-columns: minmax(100px, 130px) minmax(0, 1fr) auto;
  }
}

/* Die allgemeine Regel `td > div` stellt Zellen hochkant (Wert über
   Nebenwert). Die Namenszelle ist der Gegenfall: Kreis NEBEN dem Namen.
   Sie braucht dieselbe Spezifität, sonst gewinnt die allgemeine Regel. */
.in-fc-tabelle td > .in-fc-namenszelle {
  flex-direction: row;
  align-items: center;
}

.in-fc-namenszelle > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Karten tragen aus dem Dashboard-Raster `grid-column: span 3` mit. In der
   Akte und in jedem anderen Raster sprengt das die Aufteilung — dort zählt
   die Spalte, in der die Karte steht. */
.in-fc-akte-raster > .in-fc-karte,
.in-fc-akte-spalte > .in-fc-karte,
.in-fc-listenseite > .in-fc-karte {
  grid-column: auto;
}
