/* Prüfliste zum DGUV-V3-Prüfprotokoll – Fachwerte – v1.0 (25.09.2026)
   Gehört zu dguv-v3-pruefliste.js. Optik wie das Stammdaten-Panel
   (.stammdaten-panel / .sd-* in dguv-v3.html); Knöpfe und Kopfzeile des
   Panels nutzen dieselben Klassen (.sd-header, .btn-small, .btn-save).
   Ohne die Body-Klasse „pl-print“ ändert diese Datei nichts am Druck des
   Einzelprotokolls. */

/* ============ AKTIONSLEISTE ============ */
/* Die Knöpfe sitzen in .ab-left der Leiste (Aufbau und Umbruch regelt dguv-v3.html) */
.pl-btn-liste { position: relative; }
.pl-badge {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 6px;
  border-radius: 9px; background: #1e40af; color: #fff;
  font-size: 11px; line-height: 17px; text-align: center; font-variant-numeric: tabular-nums;
}
.pl-badge[hidden] { display: none; }
.pl-punkt {
  position: absolute; top: -4px; right: -4px; width: 12px; height: 12px;
  border-radius: 50%; background: #dc2626; border: 2px solid #fff;
}
.pl-punkt[hidden] { display: none; }
/* Beim Springen zum Blatt Kopfzeile (65px) und Knopfleiste freihalten */
.sheet { scroll-margin-top: 135px; }

/* ============ PANEL ============ */
.pl-panel {
  max-width: 210mm; margin: 15px auto 0; scroll-margin-top: 135px; background: #fff;
  border: 1px solid #d1d5db; border-radius: 10px; padding: 18px 22px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08); font-size: 10pt; color: #111;
}
.pl-panel[hidden] { display: none; }
.pl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pl-panel button:focus-visible, .pl-panel select:focus-visible, .pl-panel input:focus-visible,
.pl-btn-liste:focus-visible, .pl-btn-neu:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.pl-warnung, .pl-zurueck {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  font-size: 9pt; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px;
}
.pl-warnung { color: #7c2d12; background: #fff7ed; border-left: 3px solid #f97316; }
.pl-zurueck { color: #1e3a8a; background: #eff6ff; border-left: 3px solid #93c5fd; }
.pl-warnung[hidden], .pl-zurueck[hidden] { display: none; }
.pl-zurueck span { flex: 1; min-width: 200px; }

/* Kennzahlen */
.pl-kpis { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 12px; }
.pl-kpi {
  display: block; width: 100%; text-align: left; font-family: inherit;
  border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 10px; background: #f8fafc; color: inherit;
}
button.pl-kpi { cursor: pointer; }
button.pl-kpi:hover { background: #f1f5f9; border-color: #cbd5e1; }
.pl-kpi[aria-pressed="true"] { border-color: #1e40af; box-shadow: 0 0 0 2px #dbeafe; background: #fff; }
.pl-kpi-wert { display: block; font-size: 16pt; font-weight: 700; color: #111827; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pl-kpi-label { display: block; font-size: 7.5pt; color: #6b7280; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; margin-top: 3px; line-height: 1.25; }
.pl-kpi-sub { display: block; font-size: 7.5pt; color: #9ca3af; margin-top: 1px; }
.pl-kpi.gut .pl-kpi-wert { color: #15803d; }
.pl-kpi.warn .pl-kpi-wert { color: #b45309; }
.pl-kpi.schlecht .pl-kpi-wert { color: #b91c1c; }

/* Fristen-Hinweis */
.pl-frist {
  font-size: 9pt; color: #374151; background: #f8fafc; border-left: 3px solid #93c5fd;
  padding: 7px 11px; margin-bottom: 14px; line-height: 1.5; border-radius: 0 6px 6px 0;
}
.pl-frist strong { color: #111827; }
.pl-frist-status { display: block; margin-top: 3px; font-weight: 600; }
.pl-frist-status.gut { color: #15803d; }
.pl-frist-status.warn { color: #b45309; }

/* Filter */
.pl-filter { display: grid; grid-template-columns: 2fr 1.4fr 1.2fr 1.2fr; gap: 10px; margin-bottom: 10px; }
.pl-filter .sd-field select, .pl-werkzeuge select {
  width: 100%; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 4px;
  font-size: 10pt; font-family: inherit; outline: none; background: #fff; color: #111;
}
.pl-filter .sd-field select:focus { border-color: #1e40af; box-shadow: 0 0 0 2px #dbeafe; }
.pl-filter [hidden] { display: none; }
.pl-sort-mobil { display: none; }

/* Werkzeuge (Druck, Export) */
.pl-werkzeuge { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.pl-gruppe { display: inline-flex; flex-wrap: wrap; max-width: 100%; gap: 6px; align-items: center; padding: 3px 3px 3px 10px; border: 1px solid #e5e7eb; border-radius: 6px; background: #f8fafc; }
.pl-gruppe label { font-size: 8pt; color: #6b7280; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; }
.pl-werkzeuge select { width: auto; padding: 5px 7px; font-size: 9pt; }
.pl-werkzeuge .pl-trenner { flex: 1; }
.pl-werkzeuge .btn-small, .pl-werkzeuge .btn-save { white-space: nowrap; }

.pl-meldung { font-size: 9pt; font-weight: 600; color: #15803d; min-height: 1.3em; margin-bottom: 4px; }
.pl-meldung.fehler { color: #b91c1c; }
.pl-zaehler { font-size: 8.5pt; color: #6b7280; margin-bottom: 6px; }

/* ============ TABELLE ============ */
.pl-tabelle-wrap { border: 1px solid #e5e7eb; border-radius: 8px; overflow-x: auto; }
.pl-tabelle { width: 100%; border-collapse: collapse; font-size: 8.8pt; }
.pl-tabelle th {
  background: #f8fafc; text-align: left; font-size: 7.5pt; color: #6b7280; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.3px; border-bottom: 1px solid #e5e7eb; padding: 0; vertical-align: bottom; line-height: 1.25;
}
.pl-tabelle th.pl-th-akt { padding: 7px 6px; text-align: right; }
.pl-sort {
  display: block; width: 100%; padding: 7px 6px; background: none; border: none; cursor: pointer;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left;
}
.pl-sort:hover { color: #1e40af; }
th[aria-sort="ascending"] .pl-sort, th[aria-sort="descending"] .pl-sort { color: #1e40af; }
th[aria-sort="ascending"] .pl-sort::after { content: " ▲"; font-size: 7pt; }
th[aria-sort="descending"] .pl-sort::after { content: " ▼"; font-size: 7pt; }
.pl-tabelle td { padding: 6px 6px; border-bottom: 1px solid #f1f5f9; vertical-align: top; line-height: 1.35; }
.pl-tabelle tr.pl-zeile:hover td { background: #fafcff; }
.pl-tabelle tr.pl-zeile.offen td { background: #f8fafc; border-bottom-color: transparent; }
.pl-z-nr { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-z-geraet strong { font-weight: 600; color: #111827; }
.pl-klein { font-size: 7.5pt; color: #6b7280; }
.pl-z-datum { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-leerwert { color: #cbd5e1; }

.pl-auf {
  margin-top: 3px; background: none; border: none; padding: 1px 0; cursor: pointer;
  font: inherit; font-size: 8pt; color: #1e40af; font-weight: 600;
}
.pl-auf:hover { text-decoration: underline; }
.pl-auf .pl-pfeil { display: inline-block; transition: transform 0.15s; }
.pl-auf[aria-expanded="true"] .pl-pfeil { transform: rotate(90deg); }

.pl-chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 8pt; font-weight: 600; white-space: nowrap; }
.pl-chip.ok { background: #dcfce7; color: #166534; }
.pl-chip.mangel { background: #fef3c7; color: #92400e; }
.pl-chip.nio { background: #fee2e2; color: #991b1b; }
.pl-chip.offen { background: #f1f5f9; color: #64748b; }

.pl-faellig { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-faellig small { display: block; font-size: 7.5pt; font-weight: 600; white-space: normal; max-width: 7.5em; }
.pl-faellig.ueber { color: #b91c1c; font-weight: 700; }
.pl-faellig.bald { color: #b45309; font-weight: 600; }
.pl-faellig.ok { color: #15803d; }
.pl-gesperrt { display: inline-block; padding: 1px 7px; border-radius: 10px; background: #fee2e2; color: #991b1b; font-size: 8pt; font-weight: 700; white-space: nowrap; }

/* Aktionen gestapelt: „Öffnen“ oben, darunter Wiederholung und Löschen */
.pl-z-aktionen { text-align: right; width: 1%; }
.pl-akt-stapel { display: inline-grid; grid-template-columns: 1fr auto; gap: 3px; }
.pl-akt-stapel .pl-akt { margin-left: 0; }
.pl-akt-stapel .pl-akt:first-child { grid-column: 1 / -1; }
.pl-akt {
  background: #fff; color: #374151; border: 1px solid #d1d5db; border-radius: 5px;
  padding: 4px 8px; font-family: inherit; font-size: 8.5pt; cursor: pointer; margin-left: 3px; white-space: nowrap;
}
.pl-akt:hover { background: #f3f4f6; }
.pl-akt.primaer { color: #1e40af; border-color: #93c5fd; }
.pl-akt.primaer:hover { background: #eff6ff; }
.pl-akt.danger { color: #b91c1c; border-color: #fca5a5; }
.pl-akt.danger:hover { background: #fef2f2; }
.pl-frage { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: flex-end; color: #b91c1c; font-size: 8.5pt; font-weight: 600; white-space: normal; }

/* Verlauf eines Geräts */
.pl-detail td { background: #f8fafc; padding: 4px 8px 10px; }
.pl-verlauf { display: grid; gap: 6px; }
.pl-verlauf-titel { font-size: 8pt; font-weight: 700; color: #1e40af; text-transform: uppercase; letter-spacing: 0.4px; }
.pl-v-eintrag {
  display: grid; grid-template-columns: 7.5em 1fr auto; gap: 4px 12px; align-items: start;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 7px 10px;
}
.pl-v-eintrag.aktuell { border-color: #93c5fd; }
.pl-v-datum { font-weight: 700; font-variant-numeric: tabular-nums; }
.pl-v-mitte { font-size: 8.5pt; color: #374151; line-height: 1.45; }
.pl-v-mitte .pl-mw { font-variant-numeric: tabular-nums; }
.pl-v-maengel { color: #92400e; }
.pl-v-akt { text-align: right; white-space: nowrap; }

.pl-leer { text-align: center; color: #6b7280; font-size: 9.5pt; padding: 22px 12px; line-height: 1.5; }
.pl-leer[hidden] { display: none; }
.pl-leer .btn-small { margin-top: 8px; }

.pl-fuss { margin-top: 14px; }
.pl-sicherung { flex: 1; font-size: 8.5pt; color: #6b7280; min-width: 200px; }
.pl-sicherung.alt { color: #b45309; font-weight: 600; }

/* ============ HANDY: TABELLE WIRD ZU KARTEN ============ */
@media (max-width: 800px) {
  .pl-panel { margin: 15px 10px 0; padding: 14px 14px; }
  .pl-kpis { grid-template-columns: repeat(4, 1fr); }
  .pl-filter { grid-template-columns: 1fr 1fr; }
  .pl-f-suche { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .pl-sort-mobil { display: block; }
  .pl-tabelle-wrap { border: none; overflow: visible; }
  .pl-tabelle thead { display: none; }
  .pl-tabelle, .pl-tabelle tbody { display: block; width: 100%; }
  .pl-tabelle tr.pl-zeile {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px;
    border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; margin-top: 8px; background: #fff;
  }
  .pl-tabelle tr.pl-zeile.offen { border-radius: 8px 8px 0 0; border-bottom: none; }
  .pl-tabelle tr.pl-zeile td { display: block; padding: 0; border: none; background: none !important; }
  .pl-tabelle td[data-label]::before {
    content: attr(data-label); display: block; font-size: 7pt; color: #9ca3af;
    text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; margin-bottom: 1px;
  }
  .pl-tabelle td.pl-z-geraet { grid-column: 1 / -1; order: -2; font-size: 10pt; }
  .pl-tabelle td.pl-z-geraet::before { display: none; }
  .pl-tabelle td.pl-z-aktionen { grid-column: 1 / -1; width: auto; text-align: left; white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
  .pl-tabelle td.pl-z-aktionen::before { display: none; }
  .pl-akt { margin-left: 0; padding: 7px 11px; font-size: 9pt; }
  .pl-akt-stapel { display: flex; flex-wrap: wrap; gap: 6px; }
  .pl-frage { justify-content: flex-start; }
  .pl-tabelle tr.pl-detail { display: block; }
  .pl-tabelle tr.pl-detail td { display: block; border: 1px solid #e5e7eb; border-top: none; border-radius: 0 0 8px 8px; padding: 6px 10px 10px; }
  .pl-v-eintrag { grid-template-columns: 1fr; }
  .pl-v-akt { text-align: left; }
}
@media (max-width: 480px) {
  .pl-kpis { grid-template-columns: repeat(2, 1fr); }
  .pl-filter { grid-template-columns: 1fr; }
  .pl-kpi-wert { font-size: 14pt; }
}

/* ============ PRÜFBERICHT / FÄLLIGKEITSLISTE (nur Druck mit body.pl-print) ============ */
.pl-bericht { display: none; }

@page pl-quer {
  size: A4 landscape;
  margin: 10mm 10mm 13mm;
  @bottom-left { content: "Prüfbericht DGUV Vorschrift 3 · erstellt mit Fachwerte"; font-size: 7pt; color: #9ca3af; }
  @bottom-right { content: "Seite " counter(page) " von " counter(pages); font-size: 7pt; color: #6b7280; }
}
/* Fälligkeitsliste: gleiche Seite, eigene Fußzeile */
@page pl-quer-faellig {
  size: A4 landscape;
  margin: 10mm 10mm 13mm;
  @bottom-left { content: "Fälligkeitsliste DGUV Vorschrift 3 · erstellt mit Fachwerte"; font-size: 7pt; color: #9ca3af; }
  @bottom-right { content: "Seite " counter(page) " von " counter(pages); font-size: 7pt; color: #6b7280; }
}

@media print {
  body.pl-print > *:not(.pl-bericht) { display: none !important; }
  body.pl-print { background: #fff !important; }
  body.pl-print .pl-bericht { display: block; page: pl-quer; }
  body.pl-print .pl-bericht.faellig { page: pl-quer-faellig; }
}

.pl-bericht { font-size: 8pt; color: #111; line-height: 1.35; }
.plb-kopf {
  display: flex; align-items: flex-end; gap: 6mm;
  border-bottom: 2px solid #1e40af; padding-bottom: 2mm; margin-bottom: 3mm;
}
.plb-logo { width: 32mm; height: 14mm; display: flex; align-items: center; flex-shrink: 0; }
.plb-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.plb-titel { flex: 1; }
.plb-titel h1 { font-size: 14pt; font-weight: 700; color: #1e40af; line-height: 1.15; }
.plb-unter { font-size: 8pt; color: #4b5563; margin-top: 0.8mm; }
.plb-firma { text-align: right; font-size: 8pt; color: #374151; line-height: 1.4; }
.plb-firma strong { font-size: 9pt; color: #111; }

.plb-info { display: grid; grid-template-columns: 1.3fr 1fr 1.6fr 0.8fr; gap: 0; border: 0.5pt solid #9ca3af; margin-bottom: 3mm; }
.plb-info > div { padding: 1.5mm 2mm; border-right: 0.5pt solid #d1d5db; }
.plb-info > div:last-child { border-right: none; }
.plb-info .plb-l { display: block; font-size: 6.3pt; color: #6b7280; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; }
.plb-info .plb-w { display: block; font-size: 8.5pt; font-weight: 600; }

.plb-kpis { display: flex; gap: 2mm; margin-bottom: 3mm; }
.plb-kpi { flex: 1; border: 0.5pt solid #d1d5db; border-radius: 1.5mm; padding: 1.3mm 2mm; }
.plb-kpi b { display: block; font-size: 12pt; font-variant-numeric: tabular-nums; }
.plb-kpi span { font-size: 6.5pt; color: #6b7280; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 600; }
.plb-kpi.gut b { color: #15803d; } .plb-kpi.warn b { color: #b45309; } .plb-kpi.schlecht b { color: #b91c1c; }

.plb-tabelle { width: 100%; border-collapse: collapse; font-size: 7.3pt; margin-bottom: 3mm; }
.plb-tabelle thead { display: table-header-group; }
.plb-tabelle th {
  background: #eff6ff; color: #1e3a8a; font-weight: 700; text-align: left; font-size: 6.6pt;
  text-transform: uppercase; letter-spacing: 0.2px; padding: 1.2mm 1.3mm; border: 0.5pt solid #9ca3af;
}
.plb-tabelle td { padding: 1mm 1.3mm; border: 0.5pt solid #d1d5db; vertical-align: top; }
.plb-tabelle tr { break-inside: avoid; page-break-inside: avoid; }
.plb-tabelle tbody tr:nth-child(even) td { background: #f9fafb; }
.plb-tabelle .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plb-tabelle .nw { white-space: nowrap; }
.plb-tabelle .k { color: #4b5563; font-size: 6.6pt; }
.plb-tabelle tr.plb-mangel td { background: #fffbeb !important; }
.plb-tabelle tr.plb-nio td { background: #fef2f2 !important; }
.plb-erg { font-weight: 700; white-space: nowrap; }
.plb-erg.ok { color: #15803d; } .plb-erg.mangel { color: #b45309; } .plb-erg.nio { color: #b91c1c; } .plb-erg.offen { color: #6b7280; }
.plb-ueber { color: #b91c1c; font-weight: 700; }
.plb-bald { color: #b45309; font-weight: 700; }
.plb-gesperrt { color: #b91c1c; font-weight: 700; }

.plb-abschnitt { break-inside: avoid; page-break-inside: avoid; margin-bottom: 3mm; }
.plb-abschnitt h2 { font-size: 9.5pt; color: #1e40af; margin-bottom: 1.5mm; break-after: avoid; page-break-after: avoid; }
.plb-maengel-liste .plb-tabelle { margin-bottom: 0; }
.plb-hinweis { font-size: 7.3pt; color: #374151; border: 0.5pt solid #d1d5db; border-left: 2pt solid #93c5fd; padding: 1.8mm 2.5mm; line-height: 1.45; }
.plb-hinweis p + p { margin-top: 1mm; }
.plb-leer { font-size: 8pt; color: #6b7280; padding: 2mm 0; }

.plb-unterschriften { display: grid; grid-template-columns: 1fr 1fr; gap: 12mm; margin-top: 10mm; break-inside: avoid; page-break-inside: avoid; }
.plb-unterschrift { border-top: 0.5pt solid #111; padding-top: 1mm; font-size: 7pt; color: #4b5563; }
.plb-unterschrift strong { color: #111; font-size: 7.5pt; }

/* hidden-Attribut hat Vorrang vor den Karten-Regeln */
.pl-tabelle[hidden], .pl-tabelle tr[hidden] { display: none !important; }
