/* Abteilungen — Auslastung, Vorlauf, Aufträge und Angebote je Abteilung.
   Jeder Selektor beginnt mit .ab; nur innerhalb dieses Bereichs gilt das
   folgende Aussehen. Umschaltung schmal/breit erfolgt über eine
   Container-Abfrage auf der Breite von .ab-inhalt (Schwelle 900px).
   Farben stammen aus den CSS-Variablen auf .ab, damit der Dunkelmodus
   der App greift. */

.ab {
  --ab-flaeche: var(--karte, #fff);
  --ab-flaeche-2: var(--grund, #eef1f6);
  --ab-text: var(--text, #1b1e26);
  --ab-leise: var(--text2, #5a5e66);
  --ab-rand: var(--linie, #e1e5ec);
  --ab-blau: #1a3e8f;
  --ab-rot: #d2122e;
  --ab-gruen: #1f8a4c;
  --ab-gelb: #b26a00;
  --ab-schatten: var(--schatten, 0 1px 2px rgba(15, 42, 102, 0.06), 0 8px 24px -8px rgba(15, 42, 102, 0.18));
  --ab-rot-hell: #fde8eb;
  --ab-gelb-hell: #fbf1d6;
  --ab-gruen-hell: #e4f4ea;
  --ab-blau-hell: #e8eefa;
  --ab-anzeige: var(--anzeige, 'Barlow Semi Condensed', 'Barlow', 'Segoe UI', Arial, sans-serif);
  --ab-lese: var(--lese, 'Barlow', 'Segoe UI', Arial, sans-serif);

  display: block;
  color: var(--ab-text);
  font-family: var(--ab-lese);
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: 1.5rem;
}

.ab.ab-dunkel {
  --ab-blau: #7fa0ec;
  --ab-rot: #ff6b7d;
  --ab-gruen: #5cc98a;
  --ab-gelb: #e6b93f;
  --ab-rot-hell: #3a1820;
  --ab-gelb-hell: #33290f;
  --ab-gruen-hell: #16301f;
  --ab-blau-hell: #1b2a4d;
  --ab-schatten: var(--schatten, 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -8px rgba(0, 0, 0, 0.6));
}

.ab-kopf {
  margin: 0 0 0.5rem;
}

.ab-meldung {
  margin: 0 0 0.75rem;
  color: var(--ab-blau);
  font-weight: 600;
}

.ab-meldung:empty {
  display: none;
}

.ab-inhalt {
  display: block;
  container-type: inline-size;
  container-name: ab;
}

.ab-stand {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ab-leise);
}

.ab-hinweis {
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  font-weight: 600;
}

.ab-hinweis-gelb {
  background: rgba(178, 106, 0, 0.12);
  border: 1px solid rgba(178, 106, 0, 0.45);
  color: var(--ab-gelb);
}

.ab.ab-dunkel .ab-hinweis-gelb {
  background: rgba(230, 185, 63, 0.14);
  border-color: rgba(230, 185, 63, 0.5);
}

/* --- Firmen-Zeile ------------------------------------------------------- */

.ab-firma {
  margin-bottom: 14px;
}

.ab-titel {
  font-family: var(--ab-anzeige);
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 10px;
}

.ab-zahlen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ab-zahl {
  background: var(--ab-flaeche);
  border-radius: 14px;
  box-shadow: var(--ab-schatten);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ab-zahl-titel,
.ab-zahl-wert,
.ab-zahl-unter {
  margin: 0;
}

.ab-zahl-titel {
  font-size: 12.5px;
  color: var(--ab-leise);
}

.ab-zahl-wert {
  font-family: var(--ab-anzeige);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.ab-zahl-unter {
  font-size: 12px;
  color: var(--ab-leise);
}

.ab-nachfassen {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ab-gelb-hell);
  color: var(--ab-gelb);
  font-weight: 600;
  font-size: 13.5px;
}

.ab-fuss {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--ab-leise);
}

/* --- Wochenleiste ------------------------------------------------------- */

.ab-untertitel {
  margin: 14px 0 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ab-leise);
}

.ab-wochen {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
  align-items: end;
}

.ab-woche {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  min-width: 0;
}

.ab-balken {
  height: 64px;
  background: var(--ab-flaeche-2);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--ab-rand);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.ab-balken-fuell {
  width: 100%;
  min-height: 1px;
}

.ab-balken-gelb {
  background: var(--ab-gelb);
}

.ab-balken-gruen {
  background: var(--ab-gruen);
}

.ab-balken-rot {
  background: var(--ab-rot);
}

.ab-balken-grau {
  background: var(--ab-leise);
}

.ab-woche-wert {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ab-woche-kw {
  font-size: 11px;
  color: var(--ab-leise);
}

/* --- Karten ------------------------------------------------------------- */

.ab-karten {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.ab-karte {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--ab-flaeche);
  box-shadow: var(--ab-schatten);
  color: inherit;
  font: inherit;
  padding: 14px;
}

.ab-karte:focus-visible {
  outline: 2px solid var(--ab-blau);
  outline-offset: 2px;
}

.ab-karte-kopf {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.ab-karte-titel {
  font-family: var(--ab-anzeige);
  font-weight: 700;
  font-size: 17px;
}

.ab-karte-zeilen {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ab-zeile {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13.5px;
}

.ab-zeile-name {
  color: var(--ab-leise);
}

.ab-zeile-wert {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ab-rot {
  color: var(--ab-rot);
}

.ab-mini {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 40px;
}

.ab-mini-balken {
  flex: 1;
  min-height: 1px;
  background: var(--ab-blau);
  border-radius: 3px 3px 0 0;
}

.ab-mini-linie {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--ab-leise);
  pointer-events: none;
}

.ab-mini-achse {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ab-leise);
}

.ab-mini-text {
  font-size: 12px;
  color: var(--ab-leise);
}

.ab-karte-fuss {
  font-size: 12px;
  color: var(--ab-leise);
}

/* --- Marken ------------------------------------------------------------- */

.ab-marke {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 8px;
  line-height: 1.5;
  white-space: nowrap;
}

.ab-marke-gruen {
  background: var(--ab-gruen-hell);
  color: var(--ab-gruen);
}

.ab-marke-gelb {
  background: var(--ab-gelb-hell);
  color: var(--ab-gelb);
}

.ab-marke-rot {
  background: var(--ab-rot-hell);
  color: var(--ab-rot);
}

.ab-marke-grau {
  background: var(--ab-flaeche-2);
  color: var(--ab-leise);
}

/* --- Wartungen ---------------------------------------------------------- */

.ab-wartung {
  margin-top: 14px;
  background: var(--ab-flaeche);
  border-radius: 16px;
  box-shadow: var(--ab-schatten);
  padding: 14px;
}

.ab-wartung-zahlen {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: var(--ab-leise);
}

.ab-wartung-listen {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.ab-wartung-titel {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.ab-leer {
  margin: 0;
  font-size: 13px;
  color: var(--ab-leise);
}

/* --- Listen ------------------------------------------------------------- */

.ab-liste {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ab-rand) transparent;
}

.ab-listen-zeile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--ab-rand);
}

.ab-listen-zeile:last-child {
  border-bottom: 0;
}

.ab-liste-wer {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ab-liste-wert {
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ab-liste-klein {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--ab-leise);
}

/* --- Projektnummer als Schild zur Projektseite (Etappe 12) --------------- */

.ab-pnr {
  font-weight: 700;
  font-size: 12px;
  color: var(--ab-blau);
  background: var(--ab-blau-hell);
  border-radius: 6px;
  padding: 1px 6px;
  text-decoration: none;
  white-space: nowrap;
}

.ab-pnr:hover,
.ab-pnr:focus-visible {
  text-decoration: underline;
}

/* --- Infoblatt ---------------------------------------------------------- */

.ab-blatt {
  box-sizing: border-box;
  inset-inline: 0;
  margin: auto 0 0;
  width: 100%;
  max-width: 100vw;
  max-height: 85vh;
  border: 0;
  border-radius: 20px 20px 0 0;
  padding: 0;
  overflow: auto;
  background: var(--ab-flaeche);
  color: var(--ab-text);
}

@media (min-width: 700px) {
  .ab-blatt {
    margin: auto;
    max-width: 560px;
    border-radius: 16px;
  }
}

.ab-blatt::backdrop {
  background: rgba(10, 20, 40, 0.45);
}

.ab-blatt-innen {
  box-sizing: border-box;
  position: relative;
  padding: 18px;
}

.ab-blatt-zu {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--ab-flaeche-2);
  color: var(--ab-text);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.ab-blatt-titel {
  font-family: var(--ab-anzeige);
  font-size: 20px;
  margin: 0 0 4px;
  padding-right: 48px;
}

.ab-blatt-unter {
  color: var(--ab-leise);
  font-size: 13.5px;
  margin: 0 0 12px;
}

.ab-blatt-block {
  margin-bottom: 14px;
}

.ab-blatt-titel2 {
  font-family: var(--ab-anzeige);
  font-size: 15px;
  margin: 0 0 4px;
}

/* --- Breiter Modus (Container ≥ 900px) --------------------------------- */

@container ab (min-width: 900px) {
  .ab-zahlen {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ab-karten {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ab-wartung-listen {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Druck -------------------------------------------------------------- */

@media print {
  .ab-liste {
    max-height: none;
    overflow: visible;
  }
}

/* --- Bewegung reduzieren ------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .ab,
  .ab * {
    transition: none;
  }
}
