/* Projekt Andromeda: Bereiche der Zentrale (bisherige Apps), Reiter, Baukasten und Helfer.
   Gleiche Bausteine und Farben wie der Rest der Zentrale, nur was neu ist, steht hier. */

/* ---------- Seitenleiste am Mac: Gruppe Bereiche ---------- */

@media (min-width: 900px) {
  .seitenleiste {
    overflow-y: auto;
    scrollbar-width: none;
  }

  .seitenleiste::-webkit-scrollbar {
    display: none;
  }

  .leiste-bereiche {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 14px 0 10px;
    padding-top: 14px;
    box-shadow: 0 -1px 0 var(--linie-2);
  }

  .leiste-titel {
    margin: 0 12px 6px;
    color: var(--tinte-3);
    font-size: 11.5px;
    font-weight: 620;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .leiste-bereiche .tab {
    padding: 8px 12px;
  }

  /* Gruppe Vertrieb (seit 13.10.2026): der Titel führt zur Übersicht aller Vertriebsteile. „E-Mail-Marketing“ mit
     Zahl muss in eine Zeile passen. */
  .leiste-vertrieb .tab {
    gap: 10px;
  }

  .leiste-vertrieb .tab span:not(.zaehler) {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .leiste-vertrieb .tab .zaehler {
    min-width: 18px;
    height: 19px;
    padding: 0 5px;
    font-size: 11.5px;
  }

  a.leiste-titel-link {
    text-decoration: none;
    border-radius: 6px;
  }

  a.leiste-titel-link:hover,
  a.leiste-titel-link[aria-current='page'] {
    color: var(--tinte);
  }

  .leiste-bereiche .tab .punkt {
    justify-self: end;
  }

  .bereich-zurueck {
    display: none;
  }
}

/* ---------- Kopf eines Bereichs ---------- */

.bereich-kopfknoepfe {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bereich-kopfknoepfe .knopf svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 599px) {
  .bereich-seite .titelzeile {
    flex-direction: column;
    align-items: flex-start;
  }

  .bereich-kopfknoepfe {
    justify-content: flex-start;
  }
}

.chip.stufe {
  background: var(--flaeche-3);
  color: var(--tinte-2);
}

.chip.stufe[data-stufe='1'],
.chip.stufe[data-stufe='2'] {
  background: var(--marke-zart);
  color: var(--marke-tief);
}

.chip.stufe[data-stufe='3'] {
  background: var(--gruen-zart);
  color: var(--gruen);
}

/* ---------- Reiter ---------- */

.reiterleiste {
  display: flex;
  gap: 6px;
  margin: -6px calc(-1 * var(--seite)) 20px;
  padding: 2px var(--seite);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.reiterleiste::-webkit-scrollbar {
  display: none;
}

.reiter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--flaeche);
  box-shadow: var(--schatten-1);
  color: var(--tinte-2);
  font-size: 14.5px;
  font-weight: 560;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 120ms var(--ease-out);
}

.reiter:active {
  transform: scale(0.97);
}

.reiter[aria-current='page'] {
  background: var(--tinte);
  color: #fff;
  box-shadow: none;
}

@media (hover: hover) {
  .reiter:not([aria-current='page']):hover {
    color: var(--tinte);
    background: var(--flaeche-2);
  }
}

@media (max-width: 599px) {
  .reiterleiste {
    gap: 4px;
  }

  .reiter {
    padding: 0 12px;
    font-size: 14px;
  }
}

.reiter-gruppe {
  display: inline-flex;
  align-items: center;
  flex: none;
  margin: 0 2px 0 10px;
  color: var(--tinte-3);
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.reiter-gruppe:first-child {
  margin-left: 0;
}

.reiter-zahl {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--rot);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  line-height: 20px;
  text-align: center;
}

/* ---------- Startseite eines Bereichs (Stufe 0) ---------- */

.bereich-beschreibung {
  margin: 0 0 16px;
  max-width: 62ch;
  color: var(--tinte-2);
}

.bereich-zustand,
.laeufer-karte {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.bereich-zustand .titel,
.laeufer-karte .titel {
  font-weight: 600;
}

.bereich-zustand .unter,
.laeufer-karte .unter {
  color: var(--tinte-3);
  font-size: 14px;
}

/* ---------- Kacheln im Überblick ---------- */

.bereich-kachel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  transition: transform 120ms var(--ease-out);
}

.bereich-kachel:active {
  transform: scale(0.98);
}

.bereich-kachel .name {
  display: flex;
  align-items: center;
  font-weight: 620;
  font-size: 15.5px;
  letter-spacing: -0.01em;
}

.bereich-kachel .werte {
  color: var(--tinte-3);
  font-size: 13px;
  line-height: 1.3;
}

@media (max-width: 420px) {
  .bereich-raster {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Helfer ---------- */

.leer-klein {
  padding: 18px 16px;
  color: var(--tinte-3);
  font-size: 14.5px;
}

.unter.mehrzeilig {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.blatt-text {
  margin: 0 4px 14px;
  color: var(--tinte-2);
  font-size: 15px;
}

.blatt-text.klein {
  font-size: 13.5px;
  color: var(--tinte-3);
  overflow-wrap: anywhere;
}

.auftrag-kopf {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 4px 14px;
}

.verlauf {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.verlauf li {
  padding: 12px 14px;
  border-radius: var(--radius-m);
  background: var(--flaeche-2);
  box-shadow: inset 0 0 0 1px var(--linie-2);
}

.verlauf li[data-art='rueckfrage'],
.verlauf li[data-art='haengt'],
.verlauf li[data-art='fehler'] {
  background: var(--rot-zart);
  box-shadow: none;
}

.verlauf li[data-art='antwort'],
.verlauf li[data-art='freigabe'] {
  background: var(--marke-zart);
  box-shadow: none;
}

.verlauf li[data-art='fertig'] {
  background: var(--gruen-zart);
  box-shadow: none;
}

.verlauf-kopf {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--tinte-3);
}

.verlauf-kopf strong {
  color: var(--tinte);
  font-weight: 600;
}

.verlauf-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.helfer-wahl {
  display: grid;
  gap: 8px;
}

.helfer-wahl button {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--flaeche);
  box-shadow: inset 0 0 0 1px var(--linie);
  text-align: left;
  cursor: pointer;
}

.helfer-wahl button span {
  color: var(--tinte-3);
  font-size: 13.5px;
}

.helfer-wahl button[aria-checked='true'] {
  box-shadow: inset 0 0 0 2px var(--marke-tief);
  background: var(--marke-zart);
}

/* ---------- Finanzen ---------- */

.finanzen {
  display: grid;
  /* minmax(0, 1fr): eine breite Tabelle wischt in ihrem Rahmen, statt die Spalte und damit die Seite zu verbreitern */
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.filterzeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-hinweis,
.leise {
  color: var(--tinte-3);
  font-size: 13.5px;
}

.auswahl {
  min-height: 38px;
  padding: 0 34px 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--flaeche) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a7376' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  box-shadow: var(--schatten-1);
  color: var(--tinte);
  font: inherit;
  font-size: 14.5px;
  font-weight: 560;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.suchfeld {
  flex: 1 1 220px;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14.5px;
}

.filterchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filterchip {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--flaeche);
  box-shadow: var(--schatten-1);
  color: var(--tinte-2);
  font-size: 13.5px;
  font-weight: 560;
  cursor: pointer;
}

.filterchip[aria-pressed='true'] {
  background: var(--marke-zart);
  color: var(--marke-tief);
  box-shadow: inset 0 0 0 1.5px var(--marke-tief);
}

.finanz-raster {
  margin-bottom: 12px;
}

@media (min-width: 900px) {
  .finanz-raster {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .finanz-raster.klein {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.finanz-raster.klein .kennzahl .wert {
  font-size: 22px;
}

.kennzahl.gross .wert {
  font-size: 34px;
}

.finanz-raster .kennzahl {
  min-width: 0;
}

.finanz-raster .kennzahl .wert {
  white-space: nowrap;
}

/* Am Telefon passen große Beträge in zwei Spalten nur mit kleinerer Schrift, nie mit Umbruch. */
@media (max-width: 599px) {
  .finanz-raster .kennzahl {
    padding: 14px;
  }

  .finanz-raster .kennzahl .wert,
  .kennzahl.gross .wert {
    font-size: clamp(19px, 6.4vw, 28px);
  }

  .finanz-raster.klein .kennzahl .wert {
    font-size: clamp(17px, 5.2vw, 22px);
  }
}

/* Tabellen: am Telefon waagerecht wischbar, die Seite selbst scrollt nie waagerecht */
.tabelle-rahmen {
  overflow-x: auto;
  background: var(--flaeche);
  border-radius: var(--radius-l);
  box-shadow: var(--schatten-1);
  -webkit-overflow-scrolling: touch;
}

.ftabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}

.ftabelle th,
.ftabelle td {
  padding: 10px 12px;
  text-align: left;
}

@media (min-width: 900px) {
  .ftabelle {
    font-size: 13.5px;
  }

  .ftabelle th,
  .ftabelle td {
    padding: 9px 10px;
  }
}

.ftabelle th {
  position: sticky;
  top: 0;
  background: var(--flaeche-2);
  color: var(--tinte-3);
  font-size: 12.5px;
  font-weight: 600;
}

.ftabelle .zahl {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ftabelle tbody tr + tr td {
  border-top: 1px solid var(--linie-2);
}

.ftabelle tr.plan td {
  color: var(--tinte-3);
}

.ftabelle tfoot td {
  border-top: 1px solid var(--linie);
  font-weight: 650;
}

.ftabelle td:first-child,
.ftabelle th:first-child {
  position: sticky;
  left: 0;
  background: inherit;
}

.ftabelle tbody td:first-child,
.ftabelle tfoot td:first-child {
  background: var(--flaeche);
}

.finanz-zeile {
  min-height: 56px;
}

.finanz-zeile .unter {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.finanz-zeile.plan .titel {
  color: var(--tinte-2);
  font-weight: 560;
}

.finanz-zeile .betrag,
.betrag {
  font-variant-numeric: tabular-nums;
  color: var(--tinte);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}

.marken {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 6px;
  vertical-align: 1px;
}

.marke-klein {
  display: inline-block;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--flaeche-3);
  color: var(--tinte-2);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
}

.summenzeile {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 2px 2px 12px;
  color: var(--tinte-2);
  font-size: 14px;
}

.summenzeile b {
  color: var(--tinte);
  font-variant-numeric: tabular-nums;
}

.detail-liste {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0 4px 16px;
}

.detail-liste dt {
  color: var(--tinte-3);
  font-size: 14px;
}

.detail-liste dd {
  margin: 0;
  font-weight: 560;
  overflow-wrap: anywhere;
}

.zwei-spalten {
  display: grid;
  gap: 0 20px;
}

@media (min-width: 900px) {
  .zwei-spalten {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* LDG */
.ldg-karte {
  padding: 18px;
  margin: 4px 0 8px;
}

.ldg-kopf {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.ldg-kopf .label {
  color: var(--tinte-3);
  font-size: 14px;
  font-weight: 520;
}

.ldg-wert {
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.ldg-text {
  margin: 8px 0 12px;
  color: var(--tinte-2);
}

.ldg-werte {
  display: grid;
  max-width: 520px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 16px;
  margin: 0 0 8px;
  font-size: 14.5px;
}

.ldg-werte dt {
  color: var(--tinte-3);
}

.ldg-werte dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Steuern */
.quartal-raster {
  margin-bottom: 8px;
}

@media (min-width: 900px) {
  .quartal-raster {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 459px) {
  .quartal-raster {
    grid-template-columns: minmax(0, 1fr);
  }
}

.quartal-karte {
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}

.quartal-kopf {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quartal-wert {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.quartal-monate div {
  display: flex;
  justify-content: space-between;
  color: var(--tinte-3);
  font-size: 13.5px;
}

.guv-karte {
  max-width: 760px;
  padding: 6px 0;
}

.guv-zeile {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 16px;
  font-size: 15px;
}

.guv-zeile + .guv-zeile {
  border-top: 1px solid var(--linie-2);
}

.guv-zeile.einzug {
  padding-left: 32px;
  color: var(--tinte-3);
  font-size: 14px;
}

.guv-zeile.stark {
  font-weight: 650;
}

/* Kredit */
.verwendung-karte {
  padding: 16px;
  margin-bottom: 12px;
}

.verwendung-kopf {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--tinte-2);
  font-weight: 560;
}

.verwendung-balken {
  display: flex;
  gap: 2px;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--marke-zart);
}

.verwendung-balken .teil.ist {
  background: #0099a0;
}

.verwendung-balken .teil.plan {
  background: #0099a0;
  opacity: 0.4;
}

.verwendung-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  color: var(--tinte-2);
  font-size: 13.5px;
}

/* ---------- Diagramme ---------- */

.diagramm-karte {
  padding: 14px 14px 8px;
  margin-bottom: 8px;
}

.diagramm {
  margin: 0;
}

.diagramm-flaeche {
  position: relative;
  width: 100%;
}

.diagramm-flaeche svg {
  display: block;
  overflow: visible;
}

.diagramm .gitter {
  stroke: var(--linie-2);
  stroke-width: 1;
}

.diagramm .gitter.null {
  stroke: var(--linie);
}

.diagramm .achsentext {
  fill: var(--tinte-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.diagramm .linie {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.diagramm .heute {
  stroke: var(--tinte-3);
  stroke-width: 1;
  opacity: 0.45;
}

.diagramm .fadenkreuz {
  stroke: var(--tinte-2);
  stroke-width: 1;
}

.diagramm .marke {
  stroke: var(--flaeche);
  stroke-width: 2;
}

.diagramm .saeule.zart {
  opacity: 0.38;
}

.diagramm rect[tabindex]:focus {
  outline: none;
}

.diagramm .fang:focus-visible {
  fill: oklch(0.2 0.02 228 / 0.04);
}

.diagramm-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 8px 4px;
  color: var(--tinte-2);
  font-size: 13px;
}

.diagramm-legende span,
.verwendung-legende span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.taste {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--farbe);
}

.taste.flaeche {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.taste.flaeche.plan {
  opacity: 0.4;
}

.taste.gestrichelt {
  background: repeating-linear-gradient(90deg, var(--farbe) 0 5px, transparent 5px 8px);
}

.diagramm-tipp {
  position: absolute;
  z-index: 5;
  min-width: 150px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--flaeche);
  box-shadow: var(--schatten-2);
  font-size: 13px;
  pointer-events: none;
}

.diagramm-tipp[hidden] {
  display: none;
}

.tipp-titel {
  margin-bottom: 4px;
  color: var(--tinte-3);
  font-size: 12px;
}

.tipp-zeile {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
}

.tipp-zeile strong {
  font-variant-numeric: tabular-nums;
}

.tipp-zeile span {
  color: var(--tinte-3);
}

.diagramm-hinweis {
  margin: 6px 4px 2px;
  color: var(--tinte-3);
  font-size: 12.5px;
}

/* ---------- Überwachung: roter Live-Punkt in Seitenleiste und Kachel, solange jemand zuschaut ---------- */

.uw-live-punkt {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--rot);
  vertical-align: middle;
  flex: none;
}

.uw-live-punkt::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--rot);
  opacity: 0;
  animation: puls 2.4s var(--ease-out) infinite;
}

.leiste-bereiche .tab .uw-live-punkt {
  justify-self: end;
  margin-left: 0;
}

/* Reiter Lage (19.10.2026): Rechenwege, Zwischensummen, aufklappbare Einzelheiten */
.lage-rechenweg {
  max-width: 640px;
  gap: 8px 16px;
}

.lage-rechenweg .lage-unter {
  display: block;
  margin-top: 1px;
  color: var(--tinte-3);
  font-size: 12.5px;
  line-height: 1.35;
}

.lage-rechenweg .lage-summe {
  padding-top: 8px;
  border-top: 1px solid var(--linie, rgba(0, 0, 0, 0.12));
  color: var(--tinte);
  font-weight: 650;
}

.ftabelle tr.lage-zwischen td {
  background: var(--flaeche-3);
}

.ftabelle tr.lage-minus td.zahl {
  color: var(--rot, #c0392b);
}

.lage-details {
  margin: 8px 0 12px;
  padding: 12px 14px;
}

.lage-details > summary {
  cursor: pointer;
  color: var(--tinte-2);
  font-weight: 560;
}

.lage-details[open] > summary {
  margin-bottom: 10px;
}

.lage-regeln {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--tinte-2);
  font-size: 14px;
  line-height: 1.5;
}

.lage .ftabelle .lage-unter {
  display: block;
  color: var(--tinte-3);
  font-size: 12.5px;
  font-weight: 450;
}

/* Lage am Handy ganz lesbar: Titel brechen um statt abgeschnitten zu werden („Loch nach Umsatzsteu…“), in „Das brauche
   ich von dir“ auch der Hinweis mit der Fälligkeit */
.lage .zeile .titel {
  white-space: normal;
  overflow-wrap: anywhere; /* auch ein langes Wort wie „Vermoegensschadenhaftpflicht“ bricht um */
}

.lage .lage-zutun .finanz-zeile .unter {
  display: block;
  -webkit-line-clamp: unset;
}

.lage .finanz-zeile.lage-zwischenzeile {
  background: var(--flaeche-3);
}

.lage .finanz-zeile.lage-minuszeile .betrag,
.ftabelle tr.lage-frei-minus td.zahl:last-child {
  color: var(--rot);
}
