/* ---------------------------------------------------------------------- */
/* Karten / Bereich- & Sammler-Liste                                       */
/* ---------------------------------------------------------------------- */

.bereich-liste {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes karte-einblenden {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .bereich-liste details.bereich-karte {
    animation: karte-einblenden 0.35s ease both;
  }

  .bereich-liste details.bereich-karte:nth-of-type(1) { animation-delay: 0ms; }
  .bereich-liste details.bereich-karte:nth-of-type(2) { animation-delay: 40ms; }
  .bereich-liste details.bereich-karte:nth-of-type(3) { animation-delay: 80ms; }
  .bereich-liste details.bereich-karte:nth-of-type(4) { animation-delay: 120ms; }
  .bereich-liste details.bereich-karte:nth-of-type(5) { animation-delay: 160ms; }
  .bereich-liste details.bereich-karte:nth-of-type(n + 6) { animation-delay: 200ms; }
}

.bereich-karte {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.bereich-karte[open] {
  box-shadow: var(--shadow-md);
}

.bereich-karte > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background-color 0.15s ease;
}

.bereich-karte > summary:hover {
  background: var(--surface-hover);
}

.bereich-karte > summary::-webkit-details-marker {
  display: none;
}

.bereich-titel {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.bereich-titel .name {
  font-size: 1.02rem;
  font-weight: 600;
}

.bereich-titel .verantwortlicher {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.chevron {
  color: var(--text-tertiary);
  display: inline-flex;
  transition: transform 0.18s ease;
}

.bereich-karte[open] > summary .chevron,
.termin-gruppe[open] > summary .chevron,
.monats-gruppe[open] > summary .chevron {
  transform: rotate(90deg);
}

.sammler-count {
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: var(--surface-sunken);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.bereich-inhalt {
  padding: 2px 22px 20px;
  border-top: 1px solid var(--border);
}

.sammler-liste {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.sammler-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-sunken);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease,
    box-shadow 0.12s ease;
}

.sammler-link:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.sammler-link:active {
  transform: translateY(0);
  box-shadow: none;
}

.sammler-link:hover .chevron {
  color: var(--accent);
  transform: translateX(2px);
}

.sammler-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sammler-haupt {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.fortschritt {
  display: flex;
  align-items: center;
  gap: 7px;
}

.fortschritt-leiste {
  width: 86px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.fortschritt-fuellung {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.4s ease;
}

.fortschritt-fuellung.ist-vollstaendig {
  background: var(--success);
}

.fortschritt-label {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  font-weight: 600;
  min-width: 2.2em;
}

.kuerzel-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.sammler-name {
  font-weight: 550;
}

.sammler-meta {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.leer-hinweis {
  color: var(--text-tertiary);
  font-size: 0.86rem;
  padding: 10px 0;
}

.leer-zustand {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-tertiary);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.leer-zustand .icon-lg {
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.leer-zustand .btn {
  margin-top: 14px;
}

.aufgaben-id-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-sunken);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.kategorie-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 2px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.dokument-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

/* ---------------------------------------------------------------------- */
/* Dialoge                                                                 */
/* ---------------------------------------------------------------------- */

dialog {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0;
  width: min(440px, 90vw);
  background: var(--surface);
  color: var(--text-primary);
}

dialog.dialog-breit {
  width: min(680px, 92vw);
}

dialog::backdrop {
  background: rgba(10, 11, 16, 0.5);
  backdrop-filter: blur(2px);
}

.dialog-inner {
  padding: 24px;
}

.dialog-inner h2 {
  margin: 0 0 18px;
  font-size: 1.05rem;
}

.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--surface-sunken);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.12s ease, background 0.12s ease;
}

/* Ankreuzfeld mit Text in einer Zeile (z. B. Notfall-Bestätigung beim
   Löschen) – ohne das stünde der Haken breit und mittig über dem Text. */
.form-field label.checkbox-zeile {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 0;
  color: var(--text-primary);
}

.form-field .checkbox-zeile input[type="checkbox"] {
  width: auto;
  flex: none;
  margin-top: 2px;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.form-errors {
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 4px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.dialog-subheading {
  font-size: 0.84rem;
  font-weight: 650;
  margin: 0 0 10px;
}

/* ---------------------------------------------------------------------- */
/* Toggle-Schalter                                                         */
/* ---------------------------------------------------------------------- */

.toggle-btn {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}

.toggle-btn.aktiv {
  background: var(--success);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.toggle-btn.aktiv .toggle-knob {
  transform: translateX(16px);
}

/* ---------------------------------------------------------------------- */
/* Dokumente & Historie                                                    */
/* ---------------------------------------------------------------------- */

.dokument-liste {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dokument-liste li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

.dokument-liste a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}

.dokument-liste a:hover {
  text-decoration: underline;
}

.dokument-ordner {
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}

.dokument-ordner > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 0.12s ease;
}

.dokument-ordner > summary::-webkit-details-marker {
  display: none;
}

.dokument-ordner > summary:hover {
  background: var(--surface-hover);
}

.dokument-ordner-name {
  flex: 1;
}

.dokument-ordner[open] > summary .chevron {
  transform: rotate(90deg);
}

.dokument-ordner-inhalt {
  padding: 2px 10px 10px;
  border-top: 1px solid var(--border-strong);
}

.dokument-ordner-inhalt .dokument-liste {
  margin-top: 8px;
}

.dokument-ohne-ordner {
  margin-bottom: 14px;
}

.dokument-ohne-ordner-titel {
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.dokument-aktionen {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.dokument-verschieben-form select {
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-family: inherit;
}

.dokument-upload-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  margin-bottom: 14px;
}

.dokument-upload-form + .dokument-upload-form {
  padding-top: 14px;
  border-top: 1px solid var(--border-strong);
}

.dokument-upload-form input[type="file"] {
  flex: 1 1 100%;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: inherit;
}

.dokument-upload-form input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.dokument-upload-form input[type="file"]::file-selector-button:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

.dokument-upload-form select,
.dokument-upload-form input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: inherit;
}

.dokument-upload-form input[type="text"] {
  flex: 1 1 160px;
  min-width: 0;
}

.dokument-upload-form select:focus,
.dokument-upload-form input[type="file"]:focus,
.dokument-upload-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.vorlage-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.vorlage-form select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-family: inherit;
}

.historie-liste {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 50vh;
  overflow-y: auto;
}

.historie-eintrag {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.historie-kopf {
  display: flex;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.historie-aenderungen {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------- */
/* Filter-Toolbar & Tabelle                                                */
/* ---------------------------------------------------------------------- */

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.filter-toolbar select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
}

.filter-suche-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  display: flex;
  align-items: center;
}

.filter-suche-wrap .icon {
  position: absolute;
  left: 11px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.filter-suche {
  width: 100%;
  padding: 8px 12px 8px 33px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
}

.filter-suche:focus,
.filter-toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.tabelle-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.aufgaben-tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.aufgaben-tabelle th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.aufgaben-tabelle td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.aufgaben-tabelle tbody tr:last-child td {
  border-bottom: none;
}

.aufgaben-tabelle tbody tr {
  transition: background 0.1s ease;
}

.aufgaben-tabelle tbody tr:hover td {
  background: var(--surface-hover);
}

/* Lange Titel brechen um, damit breite Tabellen ohne Querscrollen passen. */
.aufgaben-tabelle td.zelle-umbruch {
  white-space: normal;
  min-width: 14em;
}

.aufgaben-tabelle td.zelle-umbruch-schmal {
  white-space: normal;
  min-width: 4.5em;
}

.aufgaben-tabelle tr.aufgabe-inaktiv td {
  opacity: 0.45;
}

.kennzahl {
  font-weight: 650;
}

.kennzahl.ist-gut {
  color: var(--success);
}

.kennzahl.ist-mittel {
  color: var(--warning);
}

.kennzahl.ist-schlecht {
  color: var(--danger);
}

.trend-chart-wrapper {
  padding: 16px 16px 4px;
}

.trend-chart {
  display: block;
  width: 100%;
  height: auto;
}

.trend-chart-gitter {
  stroke: var(--border);
  stroke-width: 1;
}

.trend-chart-gitter-label {
  fill: var(--text-tertiary);
  font-size: 12px;
  dominant-baseline: middle;
}

.trend-chart-linie {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-chart-punkt {
  fill: var(--accent);
}

.trend-chart-monat-label {
  fill: var(--text-tertiary);
  font-size: 12px;
  text-anchor: middle;
}

/* Auswertung: Erklärzeile und geschätzter Aufwand je Bereich */
.auswertung-erklaerung {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0 0 10px;
  padding: 0 2px;
}

.aufwand-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.aufwand-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 8px;
}

.aufwand-kopf .dialog-subheading {
  margin: 0;
}

.aufwand-spalten {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 24px;
  margin-bottom: 8px;
}

.aufwand-titel {
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.aufwand-balken-liste {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aufwand-balken-zeile {
  display: grid;
  grid-template-columns: 3.2em minmax(0, 1fr) 5.5em;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
}

.aufwand-balken-u {
  color: var(--text-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.aufwand-balken-leiste {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
}

.aufwand-balken-fuellung {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.aufwand-balken-wert {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

@media (max-width: 860px) {
  .aufwand-spalten {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tabelle-aktionen {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}
