/**
 * Fin CRM Demo - Nachbau der Optik von trialog.fincrm.de
 *
 * Alle Klassen tragen den Praefix `in-fc-`. Die Ansicht laeuft im
 * Flush-Modus und bringt Seitenleiste und Kopfzeile selbst mit; sie uebernimmt
 * deshalb ABSICHTLICH nichts aus intranet.css - eine halb angeglichene
 * Nachbildung saehe nach keiner der beiden Anwendungen aus.
 *
 * Die Werte oben stammen aus der laufenden Anwendung (ausgelesene
 * Rechenwerte), nicht aus dem Augenmass: helle Schieferflaeche, weisse
 * Karten mit 8 px Radius, 264 px breite Punkte in der Seitenleiste.
 */

/* Die Token stehen auf BEIDEN Wurzeln: Dialoge haengen an `document.body`
   und damit ausserhalb von `.in-fc` - ohne den zweiten Selektor waeren dort
   alle `var(--fc-*)` ungueltig, und der Speichern-Knopf stuende weiss auf
   weiss. */
.in-fc,
.in-fc-hintergrund {
  --fc-flaeche: #f1f5f9;
  --fc-karte: #ffffff;
  --fc-linie: #e5e7eb;
  --fc-schrift: #1b181d;
  --fc-schrift-leise: #6b7280;
  --fc-akzent: #455a64;
  --fc-orange: #f0913b;
  --fc-seite: 288px;
}

.in-fc {
  display: flex;
  position: relative;
  min-height: 100%;
  background: var(--fc-flaeche);
  color: var(--fc-schrift);
  /* Bewusst NICHT die Hausschrift: Nachgebildet wird eine fremde Anwendung,
     und die laeuft in einer Grotesk. Die Didone des Hauses auf diesen Karten
     saehe nach beidem zugleich aus und nach nichts davon richtig. */
  font-family: Roboto, 'Helvetica Neue', system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

.in-fc h1,
.in-fc h2,
.in-fc button,
.in-fc input {
  font-family: inherit;
}

/* Das Attribut allein reicht nicht: Jede Zeile setzt display, und display
   schlaegt die Voreinstellung von [hidden]. */
.in-fc [hidden] {
  display: none;
}

/* ========================================
   SEITENLEISTE
   ======================================== */

.in-fc-seite {
  width: var(--fc-seite);
  flex: 0 0 var(--fc-seite);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 12px;
  background: var(--fc-karte);
  border-right: 1px solid var(--fc-linie);
  overflow-y: auto;
  transition: width 250ms ease, flex-basis 250ms ease;
}

.in-fc--schmal .in-fc-seite {
  width: 0;
  flex-basis: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
}

.in-fc-marke {
  margin: 4px 4px 20px;
  padding: 12px 16px;
  background: #17233a;
  color: #ffffff;
  border-radius: 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-align: center;
  white-space: nowrap;
}

.in-fc-gruppe {
  display: flex;
  flex-direction: column;
  padding: 20px 16px 6px;
}

.in-fc-gruppe-titel {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fc-schrift-leise);
}

.in-fc-gruppe-sub {
  font-size: 12px;
  color: var(--fc-schrift-leise);
}

.in-fc-trenner {
  margin: 16px 12px;
  border: 0;
  border-top: 1px solid var(--fc-linie);
}

.in-fc-punkt-knopf {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fc-schrift);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.in-fc-punkt-knopf:hover {
  background: rgba(229, 231, 235, 0.55);
}

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

.in-fc-punkt-knopf--aktiv {
  background: rgba(229, 231, 235, 0.9);
}

.in-fc-punkt-knopf svg {
  flex: 0 0 auto;
  color: var(--fc-schrift-leise);
}

.in-fc-punkt-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.in-fc-punkt-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--fc-schrift-leise);
}

.in-fc-fuss {
  margin-top: auto;
  padding: 16px;
  font-size: 12px;
  color: var(--fc-schrift-leise);
}

/* ========================================
   KOPFZEILE
   ======================================== */

.in-fc-spalte-haupt {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.in-fc-kopf {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 20px;
  background: var(--fc-karte);
  border-bottom: 1px solid var(--fc-linie);
}

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

.in-fc-klapp:hover,
.in-fc-werkzeug:hover,
.in-fc-nebenknopf:hover {
  background: rgba(229, 231, 235, 0.6);
}

.in-fc-suche {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--fc-linie);
  border-radius: 8px;
  background: var(--fc-flaeche);
  color: var(--fc-schrift-leise);
}

.in-fc-suche input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fc-schrift);
  font: inherit;
}

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

.in-fc-taste {
  padding: 2px 8px;
  border: 1px solid var(--fc-linie);
  border-radius: 4px;
  background: var(--fc-karte);
  font-size: 12px;
  font-weight: 600;
}

.in-fc-werkzeuge {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.in-fc-konto {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 8px;
  border-radius: 8px;
  background: #17233a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* ========================================
   RASTER UND KARTEN
   ======================================== */

.in-fc-inhalt {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Sechs Spalten, damit sich die Kartenbreiten des Originals genau treffen:
   Kennzahlen zur Haelfte, das Balkendiagramm zu zwei Dritteln, alles
   uebrige zu einem Drittel. Mit drei Spalten bliebe neben den beiden
   Kennzahlen eine Luecke. */
.in-fc-raster {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.in-fc-warnung {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #fcd9a8;
  border-left: 5px solid var(--fc-orange);
  border-radius: 8px;
  background: #fff8ef;
  color: #7a4a12;
  line-height: 1.5;
}

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

.in-fc-karte {
  display: flex;
  flex-direction: column;
  grid-column: span 3;
  min-width: 0;
  padding: 16px 20px 12px;
  border-radius: 8px;
  background: var(--fc-karte);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.in-fc-karte--kennzahl {
  grid-column: span 3;
}

/* Das Balkendiagramm braucht Breite, sonst stehen die Statusnamen uebereinander;
   die Geburtstage stehen daneben und bekommen den Rest der Zeile. */
.in-fc-karte--breit {
  grid-column: span 4;
}

.in-fc-karte--schmal {
  grid-column: span 2;
}

.in-fc-kartenkopf {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.in-fc-kartenkopf h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

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

.in-fc-hinweis {
  flex: 0 0 auto;
  color: var(--fc-schrift-leise);
  cursor: help;
}

/* ========================================
   KENNZAHLEN
   ======================================== */

.in-fc-kennzahl {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 16px;
}

.in-fc-zahl {
  font-size: 34px;
  font-weight: 400;
  line-height: 1.1;
}

.in-fc-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 600;
}

.in-fc-trend--auf {
  color: #15803d;
}

.in-fc-trend--ab {
  color: #b91c1c;
}

/* ========================================
   DIAGRAMME
   ======================================== */

/* Zwei Angaben, die beide noetig sind: `flex: 0 0 auto`, damit das SVG als
   Flex-Kind der Karte nicht auf die Resthoehe zusammenschruempft, und das
   Seitenverhaeltnis, weil ein SVG ohne eigene Hoehenangabe sonst auf der
   Ersatzhoehe von 150 px steht - Balken und Achsenbeschriftung waren damit
   abgeschnitten. Der Wert ist die viewBox aus diagramme.js. */
.in-fc-diagramm {
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 240;
  flex: 0 0 auto;
  margin-top: 16px;
}

.in-fc-gitter {
  stroke: var(--fc-linie);
  stroke-width: 1;
}

.in-fc-achse {
  fill: var(--fc-schrift-leise);
  font-size: 11px;
  text-anchor: middle;
}

.in-fc-achse--y {
  text-anchor: end;
}

.in-fc-ringblock {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 0 8px;
}

.in-fc-ring {
  width: 150px;
  height: 150px;
  flex: 0 0 auto;
}

.in-fc-segment {
  stroke: var(--fc-karte);
  stroke-width: 2;
}

.in-fc-legende {
  flex: 1;
  min-width: 140px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.in-fc-legende li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.in-fc-punkt {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.in-fc-legende-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.in-fc-legende-wert {
  margin-left: auto;
  font-weight: 600;
  color: var(--fc-schrift-leise);
}

/* ========================================
   LISTEN
   ======================================== */

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

.in-fc-liste {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.in-fc-zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

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

.in-fc-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--fc-akzent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.in-fc-av--hell {
  background: var(--fc-flaeche);
  color: var(--fc-akzent);
}

.in-fc-haken {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--fc-linie);
  border-radius: 999px;
  background: var(--fc-karte);
  color: transparent;
  cursor: pointer;
}

.in-fc-haken:hover {
  color: var(--fc-schrift-leise);
}

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

.in-fc-zeile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.in-fc-zeile-titel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.in-fc-zeile-sub {
  font-size: 12px;
  color: var(--fc-schrift-leise);
}

.in-fc-zeile-rand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 auto;
  font-size: 13px;
}

.in-fc-kartenfuss {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
}

.in-fc-mehr {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--fc-schrift);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

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

/* ========================================
   PLATZHALTER
   ======================================== */

.in-fc-platzhalter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60vh;
  padding: 32px;
  text-align: center;
  color: var(--fc-schrift-leise);
}

.in-fc-platzhalter h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--fc-schrift);
}

.in-fc-platzhalter p {
  margin: 0;
  max-width: 46ch;
  line-height: 1.6;
}

/* ========================================
   SCHMALE FENSTER
   ======================================== */

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

  .in-fc-karte,
  .in-fc-karte--kennzahl,
  .in-fc-karte--schmal {
    grid-column: span 1;
  }

  .in-fc-karte--breit {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .in-fc-seite {
    position: absolute;
    z-index: 2;
    height: 100%;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  }

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

  .in-fc-karte,
  .in-fc-karte--kennzahl,
  .in-fc-karte--schmal,
  .in-fc-karte--breit {
    grid-column: 1 / -1;
  }

  .in-fc-suche {
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .in-fc-seite {
    transition: none;
  }
}
