/* Bausteine: Chip "Baustein" in den erweiterten Editoren, Auswahlmenü und Verwaltung unter Notizen. */
.snippetPicker { position: relative; display: inline-flex; }
.chronikSectionChips .snippetChip,
.snippetChipRow .snippetChip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.snippetChip svg { flex: 0 0 auto; opacity: .75; }
.snippetChipCaret { font-size: 10px; opacity: .6; margin-left: 1px; }
.snippetChip[aria-expanded="true"] { background: var(--soft); }

/* Eigene Zeile über Notiz- und Aufgabeneditor (dort gibt es keine Vorbereitung/Notizen-Chips). */
.snippetChipRow { margin: 0 0 7px; }
.taskDetailDialogCard > .snippetChipRow { flex: 0 0 auto; margin: 2px 0 6px; }

.snippetMenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  width: min(340px, calc(100vw - 32px));
  max-height: min(320px, 60vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel, 12px);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-dialog, 0 12px 32px rgba(0, 0, 0, .16));
  text-align: left;
}
.snippetMenu.snippetMenuUp { top: auto; bottom: calc(100% + 6px); }
.snippetMenuList { display: flex; flex-direction: column; gap: 2px; }
/* Gegen die Chip-Regel (.chronikSectionChips button) absichern: Menüzeilen sind keine Chips. */
.chronikSectionChips .snippetMenu .snippetMenuItem,
.snippetMenu .snippetMenuItem {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 40px;
  height: auto;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.snippetMenu .snippetMenuItem:hover,
.snippetMenu .snippetMenuItem:focus-visible { background: var(--soft); outline: none; }
.snippetMenuTitle { font-weight: 700; }
.snippetMenuPreview {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.snippetMenuSearch {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 8px);
  background: var(--input, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.snippetMenuEmpty { padding: 10px; color: var(--muted); font-size: 13px; line-height: 1.4; }

/* Seitenleiste: Bausteine abgesetzt über dem Archiv, beide unter einer gemeinsamen Trennlinie. */
body .notesTreePane > .notesSnippetEntry { position: relative; margin-top: 19px; }
body .notesTreePane > .notesSnippetEntry::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  border-top: 1px solid var(--line);
  pointer-events: none;
}
body .notesTreePane > .notesSnippetEntry + .notesArchiveEntry { margin-top: 0; }
body .notesTreePane > .notesSnippetEntry + .notesArchiveEntry::before { display: none; }

/* Verwaltung */
.snippetIntro { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.45; }
/* Der Editor nutzt die Dialoggestaltung des Notizeditors (.noteEditor), hier nur die Abweichungen. */
.snippetEditor .snippetEditorHeading { margin: 4px 0 0; font-size: 22px; line-height: 1.2; }
.snippetEditor .snippetTitleInput { font-weight: 600; }
.snippetEditor .noteBodyEditorBlock { margin-top: 4px; }
.snippetEditor .wysiwygEditor[data-source-id="snippetBody"] { min-height: 220px; font-size: 14px; line-height: 1.5; }
.snippetEditor .sharedEditorControls { margin-top: 8px; }
.snippetEditorActions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.snippetCard .noteCardTitle .snippetCardMark { margin-right: 6px; opacity: .6; vertical-align: -2px; }
.snippetEditorActions .primaryButton,
.snippetEditorActions .secondaryButton { width: auto; min-width: 110px; margin-top: 0; }
.snippetEditorActions #deleteSnippet { margin-right: auto; }
/* Die allgemeine Feldregel des Notizeditors (.noteEditor select) darf die Textart-Auswahl nicht verbreitern. */
.snippetEditor .editorHeadingSelect {
  width: 40px;
  min-width: 30px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 700;
}
/* Schmale Bildschirme: Formatleiste umbrechen statt über den Rand hinaus. */
@media (max-width: 560px) {
  /* Gegen .sharedEditorFormatGroup { flex-wrap: nowrap !important } aus styles.css. */
  .snippetEditor #snippetFormatToolbar.sharedEditorFormatGroup { flex-wrap: wrap !important; row-gap: 6px !important; }
  .snippetEditor #snippetFormatToolbar .sharedEditorFormatSpacer { display: none !important; }
}
