/* Notes: drei Spalten wie OneNote – Notizbücher/Abschnitte, Seiten, Seite. */
.kb-notes { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.kb-notes-top { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--kb-surface); border-bottom: 1px solid var(--kb-border); }
.kb-notes-heading { color: var(--kb-text-strong); font-size: 16px; }
.kb-notes-search { max-width: 420px; }
.kb-notes-body { display: grid; grid-template-columns: 240px 260px minmax(0, 1fr); flex: 1; min-height: 0; overflow: hidden; }
.kb-notes-nav, .kb-notes-pages { overflow-y: auto; border-right: 1px solid var(--kb-border); background: var(--kb-surface); }
.kb-notes-nav { padding: 8px 0; background: var(--kb-surface-2); }
.kb-notes-page { overflow-y: auto; background: var(--kb-bg); }
.kb-notes-empty { padding: 16px; color: var(--kb-muted); }
.kb-notes-empty-page { display: flex; justify-content: center; padding-top: 80px; }

/* Notizbücher und Abschnitte */
.kb-notes-book { margin-bottom: 4px; }
.kb-notes-book-head { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; color: var(--kb-text-strong); font-weight: 600; }
.kb-notes-book-head .kb-notes-book-icon { color: var(--kb-c, var(--kb-icon)); display: inline-flex; }
.kb-notes-book-head.kb-color-0 .kb-notes-book-icon { color: var(--kb-icon); }
.kb-notes-book-toggle { border: 0; background: none; color: var(--kb-icon); cursor: pointer; padding: 2px; display: inline-flex; }
.kb-notes-book-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-notes-more { visibility: hidden; }
.kb-notes-book-head:hover .kb-notes-more, .kb-notes-page-item:hover .kb-notes-more, .kb-notes-page-item.is-active .kb-notes-more,
.kb-notes-more:focus-visible, .kb-notes-more[aria-expanded="true"] { visibility: visible; }
@media (hover: none) { .kb-notes-more { visibility: visible; } }
.kb-notes-sections { display: flex; flex-direction: column; padding-left: 22px; }
.kb-notes-section {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 0; border-radius: 4px 0 0 4px; background: none;
  color: var(--kb-text); text-align: left; cursor: pointer; font: inherit; border-left: 4px solid var(--kb-c, var(--kb-border-strong));
  margin: 1px 0;
}
.kb-notes-section.kb-color-0 { border-left-color: var(--kb-border-strong); }
.kb-notes-section:hover { background: var(--kb-surface-hover); }
.kb-notes-section.is-active { background: var(--kb-surface); color: var(--kb-text-strong); font-weight: 600; box-shadow: inset 0 0 0 1px var(--kb-border); }
.kb-notes-section-dot { display: none; }
.kb-notes-section-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-notes-count { color: var(--kb-faint); font-size: 12px; font-weight: 400; }
.kb-notes-add { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; background: none; color: var(--kb-link); cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.kb-notes-add:hover { color: var(--kb-link-hover); }
.kb-notes-newbook { margin: 8px 12px; display: inline-flex; align-items: center; gap: 6px; }

/* Seitenliste */
.kb-notes-pages-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 8px 10px 12px; font-weight: 600; color: var(--kb-text-strong);
  border-bottom: 3px solid var(--kb-c, var(--kb-border));
}
.kb-notes-pages-head.kb-color-0 { border-bottom-color: var(--kb-border); }
.kb-notes-pages-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-notes-add-page { width: 100%; padding: 10px 12px; }
.kb-notes-page-list { display: flex; flex-direction: column; }
.kb-notes-page-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 4px; align-items: center;
  padding: 7px 6px 7px 12px; cursor: pointer; border-left: 3px solid transparent; user-select: none;
}
.kb-notes-page-item.is-sub { padding-left: 30px; }
.kb-notes-page-item:hover { background: var(--kb-surface-hover); }
.kb-notes-page-item.is-active { background: var(--kb-active-bg); border-left-color: var(--kb-link); }
.kb-notes-page-item:focus-visible { outline: 2px solid var(--kb-link); outline-offset: -2px; }
.kb-notes-page-title { grid-column: 1; color: var(--kb-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-notes-page-date { grid-column: 1; grid-row: 2; color: var(--kb-faint); font-size: 12px; }
.kb-notes-page-item .kb-notes-more { grid-column: 2; grid-row: 1 / span 2; }

/* Seite */
.kb-notes-sheet { max-width: 900px; margin: 0 auto; padding: 24px 32px 80px; }
.kb-notes-title {
  width: 100%; border: 0; border-bottom: 1px solid var(--kb-border); background: none; padding: 4px 0 8px;
  font: inherit; font-size: 26px; font-weight: 600; color: var(--kb-text-strong);
}
.kb-notes-title:focus { outline: none; border-bottom-color: var(--kb-link); }
.kb-notes-meta { color: var(--kb-muted); font-size: 12px; margin: 6px 0 12px; }
.kb-notes-toolbar {
  position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px;
  background: var(--kb-surface); border: 1px solid var(--kb-border); border-radius: 6px; margin-bottom: 12px;
}
.kb-notes-tb-sep { width: 1px; height: 20px; background: var(--kb-border); margin: 0 4px; }
.kb-notes-editor { min-height: 50vh; color: var(--kb-text-strong); line-height: 1.6; outline: none; overflow-wrap: anywhere; }
.kb-notes-editor:empty::before { content: attr(data-placeholder); color: var(--kb-faint); }
.kb-notes-editor h1 { font-size: 22px; margin: 18px 0 8px; }
.kb-notes-editor h2 { font-size: 18px; margin: 16px 0 6px; }
.kb-notes-editor h3 { font-size: 16px; margin: 14px 0 4px; }
.kb-notes-editor p { margin: 0 0 8px; }
.kb-notes-editor ul, .kb-notes-editor ol { margin: 0 0 8px; padding-left: 26px; }
.kb-notes-editor blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--kb-border-strong); color: var(--kb-muted); }
.kb-notes-editor pre { padding: 8px 12px; border-radius: 6px; background: var(--kb-surface-2); white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.kb-notes-editor a { color: var(--kb-link); }
.kb-notes-editor table { border-collapse: collapse; margin: 8px 0; }
.kb-notes-editor td, .kb-notes-editor th { border: 1px solid var(--kb-border); padding: 4px 8px; }
/* To-do-Listen */
.kb-notes-editor ul[data-todo] { list-style: none; padding-left: 4px; }
.kb-notes-editor ul[data-todo] > li { position: relative; padding-left: 26px; }
.kb-notes-editor ul[data-todo] > li::before {
  content: ''; position: absolute; left: 2px; top: .3em; width: 14px; height: 14px; border: 1.5px solid var(--kb-border-strong);
  border-radius: 3px; background: var(--kb-input-bg); cursor: pointer;
}
.kb-notes-editor ul[data-todo] > li[data-checked] { color: var(--kb-muted); text-decoration: line-through; }
.kb-notes-editor ul[data-todo] > li[data-checked]::before { background: var(--kb-link); border-color: var(--kb-link); }
.kb-notes-editor ul[data-todo] > li[data-checked]::after {
  content: ''; position: absolute; left: 7px; top: calc(.3em + 2px); width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Suchergebnisse */
.kb-notes-hits { display: flex; flex-direction: column; width: min(480px, 90vw); max-height: 60vh; overflow-y: auto; }
.kb-notes-hit { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--kb-text); }
.kb-notes-hit:hover, .kb-notes-hit:focus-visible { background: var(--kb-surface-hover); }
.kb-notes-hit strong { color: var(--kb-text-strong); }
.kb-notes-snippet { color: var(--kb-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-menu-pad { padding: 8px; }

@media (max-width: 900px) {
  .kb-notes-body { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; overflow-y: auto; }
  .kb-notes-nav, .kb-notes-pages { max-height: 32vh; border-right: 0; border-bottom: 1px solid var(--kb-border); }
  .kb-notes-page { overflow: visible; }
  .kb-notes-sheet { padding: 16px; }
  .kb-notes-top { flex-wrap: wrap; }
}
