/* Kundenwissen: gemeinsame Bausteine für die Prüfansicht (knowledge.html) und den Dialog in der
   Aufgabenliste. Markdown-Lite-Ausgabe, Dialoge, Button an der Kundenzeile. */

.customer-group > summary .customer-knowledge { order: 1; }

.kb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.kb-muted { margin: 4px 0; color: var(--muted, #6b6560); font-size: .85rem; overflow-wrap: anywhere; }

/* Markdown-Lite */
.kb-md { font-size: .92rem; line-height: 1.6; overflow-wrap: anywhere; }
.kb-md > :first-child { margin-top: 0; }
.kb-md > :last-child { margin-bottom: 0; }
.kb-md p { margin: 8px 0; }
.kb-md h4, .kb-md h5 {
  margin: 14px 0 4px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted, #6b6560);
}
.kb-md h5 { text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--ink, #1c1b1a); }
.kb-md ul, .kb-md ol { margin: 6px 0; padding-left: 22px; }
.kb-md li { margin: 3px 0; }
.kb-md hr { margin: 12px 0; border: 0; border-top: 1px solid var(--line, #ece8e4); }
.kb-md strong { font-weight: 600; }

/* Dialoge (Bestätigung und Kundenwissen) */
.kb-dialog {
  width: min(560px, calc(100% - 2rem));
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 22px;
  border: 1px solid var(--line, #ece8e4);
  border-radius: 16px;
  background: #fff;
  color: var(--ink, #1c1b1a);
  box-shadow: 0 24px 60px rgba(28, 27, 26, .2);
}
.kb-dialog::backdrop { background: rgba(28, 27, 26, .35); }
.kb-dialog h2 { margin: 0 0 8px; font-size: 1.1rem; font-weight: 600; overflow-wrap: anywhere; }
.kb-dialog p { margin: 8px 0; font-size: .9rem; overflow-wrap: anywhere; }
.kb-dialog label { display: block; margin: 14px 0 0; font-size: .85rem; font-weight: 500; }
.kb-dialog label input[type="text"], .kb-dialog label select { margin-top: 6px; width: 100%; }
.kb-dialog .kb-check { display: flex; align-items: flex-start; gap: 10px; }
.kb-dialog .kb-check input { width: auto; margin-top: 3px; flex: 0 0 auto; }
.kb-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kb-dialog-head button { flex: 0 0 auto; min-height: 32px; }
.kb-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.kb-quote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--line, #ece8e4);
  color: #4a4541;
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.kb-dialog .kb-warn { padding: 8px 12px; border: 1px solid #f2dfc2; border-radius: 10px; background: #fff7ec; color: #7a4300; font-weight: 500; }
.kb-dialog .kb-danger-solid { background: #b42318; border-color: #b42318; color: #fff; }
.kb-dialog .kb-danger-solid:hover { background: #8f1c12; border-color: #8f1c12; }

.kb-lookup { width: min(760px, calc(100% - 2rem)); }
.kb-lookup-section { padding-top: 12px; margin-top: 12px; border-top: 1px solid #f1ede9; }
.kb-lookup-section h3 { margin: 0 0 4px; font-size: .95rem; font-weight: 600; }

/* Kundenseiten mit Projekten: Unterüberschrift, „unsicher“-Chip, Sprungnavigation, Fachlicher Hintergrund */
.kb-md h5 { margin: 14px 0 4px; padding-top: 6px; border-top: 1px dashed var(--line, #ece8e4); }
.kb-md h5.is-target { background: #fff9f2; }
.md-unsure { display: inline-block; margin: 0 2px; padding: 0 7px; border-radius: 7px; background: #f1efed; color: #6d6862; font-size: .75rem; font-weight: 400; line-height: 1.5; vertical-align: baseline; }
.kb-unknown { font-style: italic; color: var(--muted, #6d6862); }
.kb-projects { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 10px; }
.kb-projects[hidden] { display: none; }
.kb-projects-label { color: var(--muted, #6d6862); font-size: .8rem; }
.kb-project-jump { margin: 0; padding: 2px 10px; border: 1px solid var(--line, #ece8e4); border-radius: 999px; background: transparent; color: inherit; font-size: .8rem; min-height: 0; max-width: 100%; overflow-wrap: anywhere; }
.kb-project-chip { padding: 0 8px; border-radius: 7px; background: #eef3f7; color: #3a5163; font-size: .75rem; overflow-wrap: anywhere; }
.kb-lookup-prominent { padding: 12px 14px; border: 1px solid var(--line, #ece8e4); border-left: 3px solid var(--brand, #c96442); border-radius: 10px; background: #fcfaf8; }
/* Historie: native details/summary, initial geschlossen (Maus, Enter und Leertaste über den Browser) */
.kb-history { margin-top: 14px; padding-top: 10px; border-top: 1px solid #f1ede9; max-width: 100%; }
.kb-history-summary { padding: 6px 0; font-size: .95rem; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.kb-history-summary:focus-visible { outline: 2px solid var(--focus, #161616); outline-offset: 2px; border-radius: 4px; }
.kb-history[open] > .kb-md, .kb-history[open] > .kb-section { margin-top: 4px; }
.kb-lookup-body, .kb-lookup .kb-md { max-width: 100%; overflow-wrap: anywhere; }

/* Lesefassung der Wissensseiten: je Stichpunkt eine Zeile mit Kopf (Name/Monat), Teilaussagen und Marken. */
.kb-md > p { max-width: 80ch; line-height: 1.65; }
.kb-md ul.md-entries { max-width: 110ch; }
.kb-md .md-group {
  margin: 16px 0 2px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted, #6b6560);
}
.kb-md > .md-group:first-child { margin-top: 0; }
.kb-md ul.md-entries { margin: 4px 0 10px; padding: 0; list-style: none; }
.kb-md .md-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 16px;
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid #f1ede9;
  line-height: 1.5;
  overflow-wrap: break-word;
}
.kb-md .md-entry:last-child { border-bottom: 0; }
.kb-md .md-entry:not(.has-lead) { padding-left: 14px; position: relative; }
.kb-md .md-entry:not(.has-lead)::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 1.05em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c9c2bb;
}
.kb-md .md-entry.has-lead { grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr) auto; }
.kb-md .md-lead { font-weight: 600; color: var(--ink, #1c1b1a); }
.kb-md .md-body { min-width: 0; }
.kb-md ul.md-parts { margin: 0; padding: 0; list-style: none; min-width: 0; }
.kb-md .md-text + ul.md-parts { margin-top: 3px; }
.kb-md ul.md-parts li { margin: 0 0 2px; padding-left: 12px; position: relative; }
.kb-md ul.md-parts li::before { content: "–"; position: absolute; left: 0; color: #a39c95; }
.kb-md .md-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; max-width: 13rem; padding-top: 2px; }
.kb-md .md-stand, .kb-md .md-stale, .kb-md .md-note, .kb-md .md-meta .md-unsure {
  display: inline-block;
  margin: 0;
  padding: 0 7px;
  border-radius: 7px;
  font-size: .72rem;
  line-height: 1.6;
  white-space: nowrap;
}
.kb-md .md-stand { background: #f4f2f0; color: #6d6862; }
.kb-md .md-meta .md-unsure { background: #fff3e0; color: #8a5300; }
.kb-md .md-stale { background: #f3f0ec; color: #8a817a; font-style: italic; }
.kb-md .md-note { background: #eef3f7; color: #3a5163; white-space: normal; }
@media (max-width: 640px) {
  .kb-lookup { width: calc(100% - 1rem); }
  .kb-lookup-body { overflow-x: hidden; }
  .kb-md .md-entry, .kb-md .md-entry.has-lead { grid-template-columns: minmax(0, 1fr); }
  .kb-md .md-meta { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; }
}
