/* Kundenchronik und Aufgaben (Ordner Crm/, Klassen ch-* und ag-*). Regeln wie oo.css: Farben nur aus den Marken dort,
   Ecken 3 px, Haarlinien, Zeilen 28 px, Blau nur für den Hauptknopf und den Fokus. */

/* ── Chronik in der Kundenakte (Baustein KundenChronik) ──────────────────────── */
.ch { display: flex; flex-direction: column; gap: 12px; }
.ch h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--tinte-2); }

/* Eingabe */
.ch-eingabe { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--linie); }
.ch-art { display: flex; flex-wrap: wrap; gap: 0; }
.ch-art button { height: 26px; padding: 0 8px; border: 1px solid var(--linie-stark); margin-left: -1px; background: var(--flaeche); color: var(--tinte-3);
  font-size: 12px; cursor: pointer; }
.ch-art button:first-child { margin-left: 0; border-radius: 3px 0 0 3px; }
.ch-art button:last-child { border-radius: 0 3px 3px 0; }
.ch-art button.aktiv { position: relative; background: var(--flaeche-2); color: var(--tinte-1); font-weight: 600; border-color: var(--tinte-4); z-index: 1; }
.ch-art button:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; z-index: 2; }
.ch textarea.ein, .ag-akte textarea.ein, .ag-maske textarea.ein { height: auto; min-height: 64px; padding: 6px 8px; resize: vertical; line-height: 1.4; font: inherit; }
.ch-mehr summary { cursor: pointer; color: var(--tinte-4); font-size: 12px; padding: 2px 0; }
.ch-felder { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding-top: 6px; }
.ch-felder label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--tinte-4); min-width: 0; }
.ch-felder .ch-datei { grid-column: 1 / -1; }
.ch-gewaehlt { grid-column: 1 / -1; margin: 0; padding-left: 16px; font-size: 12px; }
.ch-aktionen { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.ch-tipp { margin-right: auto; font-size: 11px; }
.ch-hinweis { margin: 0; font-size: 12px; }
.ch-hinweis-355 { padding: 6px 8px; border: 1px solid var(--linie); border-radius: 3px; background: var(--warn-grund); color: var(--tinte-2); }

/* Offene Aufgaben */
.ch-offen ul { margin: 0; padding: 0; list-style: none; }
/* Titel in der ersten Zeile, wer und wann darunter: neben dem Titel schnitt die Akte (448 px, am Handy 390) „überfällig seit …“ ab. */
.ch-offen li { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; min-height: 28px; padding: 3px 0; border-bottom: 1px solid var(--linie-fein); font-size: 13px; }
.ch-offen li .ch-aufgabe { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.ch-offen li .blass { flex: 1 0 100%; min-width: 0; padding-left: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.ch-offen li.ueberfaellig .blass { color: var(--warn); }
.ch-offen-alle { display: inline-block; margin-top: 4px; font-size: 12px; }

/* Filter */
.ch-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ch-chips .chip.aktiv { background: var(--flaeche-2); color: var(--tinte-1); border-color: var(--tinte-4); font-weight: 600; }

/* Zeitleiste */
.ch-zeitleiste { display: flex; flex-direction: column; }
.ch-monat { margin: 10px 0 4px; padding-bottom: 2px; border-bottom: 1px solid var(--linie); font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--tinte-4); text-transform: uppercase; }
.ch-monat:first-child { margin-top: 0; }
.ch-eintrag { padding: 6px 0; border-bottom: 1px solid var(--linie-fein); font-size: 13px; }
.ch-kopf { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 22px; color: var(--tinte-2); }
.ch-kopf > svg { flex: 0 0 auto; color: var(--tinte-4); }
.ch-kopf .blass { color: var(--tinte-5); }
.ch-knoepfe { margin-left: auto; display: inline-flex; gap: 2px; }
.ch-knoepfe .kn { height: 22px; width: 22px; }
.ch-text-inhalt { margin: 2px 0 0 18px; color: var(--tinte-1); white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.ch-geaendert { display: block; margin-left: 18px; font-size: 11px; }
.ch-anhaenge { margin: 4px 0 0 18px; padding: 0; list-style: none; font-size: 12px; }
.ch-eintrag .ein { margin-top: 4px; }
.ch-eintrag .ch-aktionen { margin-top: 4px; }
.ch-datei-oeffnen { padding: 0; border: 0; background: none; color: var(--tinte-1); text-decoration: underline; text-decoration-color: var(--linie-stark);
  cursor: pointer; font: inherit; }
.ch-datei-oeffnen:hover { text-decoration-color: currentColor; }
.ch-leer { margin: 4px 0; font-size: 13px; }
.ch-weiter { align-self: flex-start; }

/* Reiter der Kundenakte: mit der Chronik passen fünf Reiter erst ab rund 450 px Breite der Akte (bei 1280 px Fenster sind es
   397 px, am Handy 390): die Leiste rollt zur Seite wie die der Belegakte am Handy. Die Linie darunter als Schatten innen, sonst
   schnitte der rollende Kasten den Strich des gewählten Reiters ab (sein negativer Rand ragte hinaus). */
.reiter.ch-reiter { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; border-bottom: 0; box-shadow: inset 0 -1px var(--linie); }
.reiter.ch-reiter::-webkit-scrollbar { display: none; }
.reiter.ch-reiter button { margin-bottom: 0; flex: 0 0 auto; }

/* Schmal (Akte am Handy als ganzer Schirm): Felder untereinander. */
@container (max-width: 380px) {
  .ch-felder { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .ch-felder { grid-template-columns: 1fr; }
}

/* ── Seite „Aufgaben“ (AufgabenSeite, AufgabeAkte, AufgabeMaske) ──────────────── */
.ag-kopf .ag-ansicht { width: auto; min-width: 150px; }
.ag-kopf .ag-wer, .ag-kopf .ag-prio { width: auto; min-width: 130px; }
.ag-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ag-chips .chip.aktiv, .ag-kunde-filter.aktiv { background: var(--flaeche-2); color: var(--tinte-1); border-color: var(--tinte-4); font-weight: 600; }
.ag-kunde-filter { gap: 4px; }
.ag-flaeche .af-c.c-haken { justify-content: center; }
/* Die Kopfleiste richtet sich nach der Breite der Liste (neben der Akte, am Handy): unter 760 px stehen die Fälligkeiten als eigene,
   seitlich wischbare Zeile unter Ansicht und Suche, Verantwortlich, Priorität und Kunde in einer dritten. ☠️ Nicht af-chips: die
   blendet oo.css unter 560 px aus. */
.ag-flaeche > .af-mitte { container-type: inline-size; }
@container (width < 760px) {
  .ag-kopf { flex-wrap: wrap; row-gap: 6px; }
  .ag-kopf .ag-ansicht { min-width: 0; flex: 0 1 150px; }
  .ag-kopf .af-suche { flex: 1 1 120px; min-width: 120px; }
  .ag-chips { order: 10; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .ag-chips::-webkit-scrollbar { display: none; }
  .ag-chips .chip { flex: 0 0 auto; }
  .ag-kopf .ag-wer, .ag-kopf .ag-prio { order: 11; flex: 1 1 0; min-width: 0; }
  .ag-kopf .ag-kunde-filter { order: 12; max-width: 100%; }
  .ag-kopf .af-fuell { display: none; }
}
.ag-haken { margin: 0; cursor: pointer; }
.ag-titel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ag-zeile-erledigt .ag-titel { text-decoration: line-through; color: var(--tinte-5); }
.ag-ueberfaellig { color: var(--warn); font-weight: 600; }
.ag-prio-2 { color: var(--tinte-1); font-weight: 600; }
.ag-prio-0 { color: var(--tinte-5); }
.ag-karte { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; height: 100%; padding: 0 12px; }
.ag-k1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ag-k2 { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 24px; }

/* Akte */
.ag-akte-kopf { display: flex; align-items: center; gap: 6px; }
.ag-erledigt { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ag-erledigt strong { font-size: 15px; overflow-wrap: anywhere; }
.ag-durch { text-decoration: line-through; color: var(--tinte-5); }
.ag-beschreibung { white-space: pre-wrap; }
.ag-wer { font-size: 12px; margin: 6px 0 0; }
.ag-kommentare { margin: 0 0 6px; padding: 0; list-style: none; }
.ag-kommentare li { padding: 4px 0; border-bottom: 1px solid var(--linie-fein); font-size: 13px; }
.ag-kommentare .ch-text-inhalt { margin-left: 0; white-space: pre-wrap; }
.ag-dateien .ch-anhaenge { margin-left: 0; }

/* Maske */
.ag-maske .fm-raster { grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.ag-feld { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--tinte-4); min-width: 0; }
.ag-feld.ag-breit { grid-column: 1 / -1; }
.ag-feld .pflicht { color: var(--alarm); margin-left: 2px; }
.ag-faellig { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ag-faellig .ein { width: auto; }
.ag-schnell { display: flex; flex-wrap: wrap; gap: 4px; }
.ag-kunde-gewaehlt { display: inline-flex; align-items: center; gap: 4px; color: var(--tinte-1); font-size: 13px; }
.ag-treffer { margin: 2px 0 0; padding: 0; list-style: none; border: 1px solid var(--linie); border-radius: 3px; }
.ag-treffer li { padding: 2px 8px; border-bottom: 1px solid var(--linie-fein); }
.ag-treffer li:last-child { border-bottom: 0; }
@media (max-width: 640px) {
  .ag-maske .fm-raster { grid-template-columns: 1fr; }
}
