/* ─── Manetti Notizbuch ─────────────────────────────────────────────────────
   Orientiert sich an OneNote (Fluent): Systemschrift, flache Spalten
   Abschnitte | Seiten, graue Auswahlflächen, schlichtes Menüband. */

.nb-app {
  --nb-font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --nb-bg: #f7f7f7;
  --nb-nav-bg: #f3f3f3;
  --nb-page-default: #ffffff;
  --nb-line: #e3e3e3;
  --nb-hover: rgba(0, 0, 0, 0.045);
  --nb-active: rgba(0, 0, 0, 0.075);
  --nb-field: rgba(0, 0, 0, 0.04);
  --nb-ink: #1f1f1f;
  --nb-text: #1f1f1f;
  --nb-strong: #1f1f1f;
  --nb-muted: #6b6b6b;
  --nb-faint: #9a9a9a;
  --nb-paper-line: rgba(80, 120, 190, 0.18);
  --nb-accent: #1f1f1f;
  --nb-focus: #2f6fdb;
  --nb-pop: #ffffff;
  --nb-shadow: 0 8px 28px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.08);

  position: relative;
  display: flex;
  height: calc(100vh - 90px);
  min-height: 0;
  color: var(--nb-strong);
  background: var(--nb-bg);
  border: 1px solid var(--nb-line);
  border-radius: 8px;
  overflow: hidden;
  font-family: var(--nb-font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body.dark .nb-app {
  --nb-bg: #1c1c1c;
  --nb-nav-bg: #202020;
  --nb-page-default: #262626;
  --nb-line: #333333;
  --nb-hover: rgba(255, 255, 255, 0.05);
  --nb-active: rgba(255, 255, 255, 0.085);
  --nb-field: rgba(255, 255, 255, 0.06);
  --nb-ink: #ececec;
  --nb-text: #e6e6e6;
  --nb-strong: #f0f0f0;
  --nb-muted: #a3a3a3;
  --nb-faint: #747474;
  --nb-paper-line: rgba(150, 175, 230, 0.13);
  --nb-accent: #f0f0f0;
  --nb-focus: #6ea0ff;
  --nb-pop: #2c2c2c;
  --nb-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
}

.nb-app button, .nb-app input, .nb-app select { font-family: var(--nb-font); color: inherit; }

.nb-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--nb-muted) !important;
  cursor: pointer;
  flex-shrink: 0;
}
.nb-icon-btn:hover { background: var(--nb-hover); color: var(--nb-strong) !important; }

/* ── Navigation ─────────────────────────────────────────────────────────── */
.nb-nav {
  width: 470px;
  min-width: 470px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--nb-nav-bg);
  border-right: 1px solid var(--nb-line);
  transition: margin-left 0.18s ease;
}
.nb-app.nb-nav-collapsed .nb-nav { margin-left: -471px; }

.nb-nav-top {
  display: flex;
  align-items: center;
  padding: 8px 8px 4px;
}

.nb-notebook-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 16px;
  font-weight: 600;
}
.nb-notebook-btn:hover { background: var(--nb-hover); }
.nb-notebook-btn > svg:last-child { color: var(--nb-muted); }
.nb-notebook-icon { display: inline-flex; }
.nb-notebook-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  margin: 2px 12px 10px;
  padding: 0 10px;
  border-radius: 4px;
  background: var(--nb-field);
  border-bottom: 1px solid transparent;
  color: var(--nb-muted);
}
.nb-search:focus-within { border-bottom-color: var(--nb-focus); }
.nb-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--nb-strong);
  font-size: 14px;
}
.nb-search input::placeholder { color: var(--nb-muted); }

.nb-panes {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 190px 1fr;
  border-top: 1px solid var(--nb-line);
}
.nb-sections, .nb-pages { display: flex; flex-direction: column; min-height: 0; }
.nb-sections { border-right: 1px solid var(--nb-line); }
.nb-pages { background: var(--nb-bg); }

.nb-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 42px;
  padding: 0 6px 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--nb-muted);
  flex-shrink: 0;
}
.nb-pane-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nb-section-list, .nb-page-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 6px 12px;
  scrollbar-width: thin;
}

.nb-section {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 8px 0 10px;
  margin-bottom: 1px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  color: var(--nb-strong);
}
.nb-section-tab {
  width: 10px;
  height: 14px;
  border-radius: 2px;
  background: var(--sec);
  flex-shrink: 0;
}
.nb-section-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-count { font-size: 12px; color: var(--nb-faint); font-variant-numeric: tabular-nums; }
.nb-section:hover { background: var(--nb-hover); }
.nb-section.active { background: var(--nb-active); font-weight: 600; }
.nb-section.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 2px;
  background: var(--sec);
}
.nb-section.drop-target { box-shadow: inset 0 0 0 1px var(--sec); }

.nb-page-item {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-height: 36px;
  padding: 6px 34px 6px 14px;
  margin-bottom: 1px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--nb-strong);
}
/* Einrückung pro Ebene; links davon sitzt der Auf-/Zuklapp-Pfeil */
.nb-page-item { padding-left: 30px; }
.nb-page-item.lvl-1 { padding-left: 54px; }
.nb-page-item.lvl-2 { padding-left: 78px; }
.nb-page-toggle {
  position: absolute;
  top: 50%;
  left: 7px;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--nb-muted);
  transition: transform 0.12s ease;
}
.nb-page-item.lvl-1 .nb-page-toggle { left: 31px; }
.nb-page-item.lvl-2 .nb-page-toggle { left: 55px; }
.nb-page-toggle:hover { background: var(--nb-active); color: var(--nb-strong); }
.nb-page-toggle.collapsed { transform: rotate(-90deg); }
.nb-app.nb-dragging-page, .nb-app.nb-dragging-page * { cursor: grabbing !important; user-select: none; }
.nb-page-item { touch-action: pan-y; }
.nb-page-item:hover { background: var(--nb-hover); }
.nb-page-item.active { background: var(--nb-active); }
.nb-page-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 2px;
  background: var(--nb-accent);
}
.nb-page-item.dragging { opacity: 0.4; }
.nb-page-item.drop-before::after,
.nb-page-item.drop-after::after {
  content: "";
  position: absolute;
  left: var(--drop-indent, 14px);
  right: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--nb-focus);
  pointer-events: none;
}
.nb-page-item.drop-before::after { top: -1px; }
.nb-page-item.drop-after::after { bottom: -1px; }
.nb-page-item.drop-self { box-shadow: inset 0 0 0 1px var(--nb-focus); padding-left: var(--drop-indent, 14px); }
.nb-page-item:focus-visible { outline: 2px solid var(--nb-focus); outline-offset: -2px; }
.nb-page-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.nb-page-item.active .nb-page-title { font-weight: 600; }
.nb-page-item.lvl-1 .nb-page-title, .nb-page-item.lvl-2 .nb-page-title { color: var(--nb-text); }
.nb-page-sub, .nb-page-path {
  font-size: 12px;
  color: var(--nb-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.nb-shared { display: inline-flex; color: var(--nb-muted); }
.nb-page-more {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  color: var(--nb-muted);
  opacity: 0;
}
.nb-page-item:hover .nb-page-more { opacity: 1; }
.nb-page-more:hover { background: var(--nb-active); color: var(--nb-strong); }
.nb-muted { margin: 8px 14px; font-size: 13px; color: var(--nb-muted); line-height: 1.5; }

/* Papierkorb */
.nb-trash-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  margin: 0 6px 8px;
  padding: 0 10px;
  border: 0;
  border-top: 1px solid var(--nb-line);
  border-radius: 0;
  background: transparent;
  color: var(--nb-muted) !important;
  font-size: 13.5px;
  cursor: pointer;
  flex-shrink: 0;
}
.nb-trash-btn span:first-of-type { flex: 1; text-align: left; }
.nb-trash-btn:hover { color: var(--nb-strong) !important; background: var(--nb-hover); }
.nb-trash-btn.active { color: var(--nb-strong) !important; background: var(--nb-active); border-radius: 4px; border-top-color: transparent; }
.nb-page-item.nb-trashed .nb-page-title { color: var(--nb-muted); }

.nb-text-btn {
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--nb-focus) !important;
  font-size: 13px;
  cursor: pointer;
}
.nb-text-btn:hover { background: var(--nb-hover); }
.nb-pane-head .nb-text-btn { margin-left: auto; }

/* ── Hauptbereich ───────────────────────────────────────────────────────── */
.nb-main {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--nb-bg);
}

.nb-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 10px;
  flex-shrink: 0;
}
.nb-back { display: none; }
.nb-crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--nb-muted);
  white-space: nowrap;
  overflow: hidden;
}
.nb-crumbs span { display: inline-flex; align-items: center; overflow: hidden; text-overflow: ellipsis; }
.nb-crumb-sep { opacity: 0.7; }
.nb-crumb-sec { color: var(--nb-strong); }
.nb-crumb-sec::before {
  content: "";
  width: 8px;
  height: 11px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--sec);
  flex-shrink: 0;
}
.nb-topbar-right { display: flex; align-items: center; gap: 12px; }
.nb-save-state { font-size: 12.5px; color: var(--nb-faint); white-space: nowrap; }
.nb-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 4px 0 10px;
  border-radius: 4px;
  border: 1px solid var(--nb-line);
  background: var(--nb-page-default);
  color: var(--nb-muted);
}
.nb-share:hover { border-color: var(--nb-faint); }
.nb-share select {
  max-width: 160px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--nb-strong);
  font-size: 13px;
  cursor: pointer;
}
.nb-share select option, .nb-select option { background: var(--nb-pop); color: var(--nb-text); }

/* Menüband */
.nb-tabs {
  display: flex;
  gap: 4px;
  padding: 0 10px;
  flex-shrink: 0;
}
.nb-tab {
  position: relative;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px 4px 0 0;
  background: transparent;
  color: var(--nb-muted) !important;
  cursor: pointer;
  font-size: 14px !important;
}
.nb-tab:hover { color: var(--nb-strong) !important; background: var(--nb-hover); }
.nb-tab.active { color: var(--nb-strong) !important; font-weight: 600; }
.nb-tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 3px;
  border-radius: 2px;
  background: var(--nb-focus);
}

.nb-ribbon {
  margin: 0 8px;
  border: 1px solid var(--nb-line);
  border-radius: 6px;
  background: var(--nb-page-default);
  flex-shrink: 0;
}
.nb-ribbon-panel {
  display: none;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nb-ribbon-panel::-webkit-scrollbar { display: none; }
.nb-ribbon-panel.active { display: flex; }

.nb-group {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 6px;
  position: relative;
  flex-shrink: 0;
}
.nb-group + .nb-group::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--nb-line);
}
.nb-group-label { font-size: 12.5px; color: var(--nb-muted); padding: 0 6px; white-space: nowrap; }

.nb-rb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 14px !important;
  white-space: nowrap;
  color: var(--nb-strong) !important;
}
.nb-rb svg { width: 17px; height: 17px; }
.nb-rb:hover { background: var(--nb-hover); }
.nb-rb:active { background: var(--nb-active); }
.nb-rb.active { background: var(--nb-active); box-shadow: inset 0 0 0 1px var(--nb-line); }
.nb-rb span { font-size: 13px; }
.nb-rb sup, .nb-rb sub { font-size: 9px; }
.nb-rb b, .nb-rb i, .nb-rb u, .nb-rb s { font-family: Georgia, "Times New Roman", serif; font-size: 15px; }
.nb-zoom-label { min-width: 54px; font-variant-numeric: tabular-nums; }

.nb-color-a { position: relative; font-weight: 600; padding-bottom: 3px; }
.nb-color-a i {
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -1px;
  height: 3px;
  background: #e03131;
}

.nb-select {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--nb-line);
  border-radius: 4px;
  background: var(--nb-page-default);
  color: var(--nb-strong);
  font-size: 13px;
  cursor: pointer;
  outline: 0;
}
.nb-select:hover { border-color: var(--nb-faint); }
.nb-select:focus { border-color: var(--nb-focus); }
.nb-font { width: 150px; }
.nb-size { width: 62px; }

.nb-swatches { gap: 5px; }
.nb-swatch {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: var(--sw);
  cursor: pointer;
  flex-shrink: 0;
}
body.dark .nb-swatch { border-color: rgba(255, 255, 255, 0.2); }
.nb-swatch.active { box-shadow: 0 0 0 2px var(--nb-page-default), 0 0 0 4px var(--nb-focus); }
.nb-swatch-auto { background: linear-gradient(135deg, #1f1f1f 50%, #f2f2f2 50%); }
.nb-swatch-none { background: linear-gradient(135deg, transparent 45%, #e03131 45%, #e03131 55%, transparent 55%); }
.nb-swatch-custom {
  display: inline-block;
  overflow: hidden;
  background: conic-gradient(#e03131, #f0b400, #2f9e44, #1c7ed6, #9c36b5, #e03131);
}
.nb-swatch-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.nb-page-swatch { border-radius: 4px; }
.nb-page-swatch[data-pagecolor=""] { background: var(--nb-page-default); }

.nb-width { gap: 8px; }
.nb-width input { width: 110px; accent-color: var(--nb-focus); }
.nb-width-dot {
  width: var(--d, 6px);
  height: var(--d, 6px);
  border-radius: 50%;
  border: 1px solid var(--nb-line);
  flex-shrink: 0;
}

/* ── Seite ──────────────────────────────────────────────────────────────── */
.nb-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  overflow: auto;
  background: var(--nb-page-default);
  border-top: 1px solid var(--nb-line);
}
.nb-scroll.drop-files { outline: 2px dashed var(--nb-focus); outline-offset: -8px; }
.nb-sizer { position: relative; }
.nb-sizer[hidden] { display: none; }

.nb-page {
  --nb-page-bg: initial;
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  color: var(--nb-text);
  background-color: var(--nb-page-default);
  touch-action: pan-x pan-y;
}
.nb-page.nb-page-custom { background-color: var(--nb-page-bg); }
.nb-page.nb-page-light {
  --nb-ink: #1f1f1f;
  --nb-text: #1f1f1f;
  --nb-muted: #6b6b6b;
  --nb-paper-line: rgba(80, 120, 190, 0.2);
}
.nb-page[data-paper="lines"] {
  background-image: linear-gradient(to bottom, transparent 31px, var(--nb-paper-line) 31px, var(--nb-paper-line) 32px);
  background-size: 100% 32px;
}
.nb-page[data-paper="grid"] {
  background-image:
    linear-gradient(to right, var(--nb-paper-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--nb-paper-line) 1px, transparent 1px);
  background-size: 24px 24px;
}
.nb-page[data-paper="dots"] {
  background-image: radial-gradient(circle, var(--nb-paper-line) 1.4px, transparent 1.6px);
  background-size: 22px 22px;
  background-position: 11px 11px;
}

.nb-app[data-tool="pen"] .nb-page,
.nb-app[data-tool="highlighter"] .nb-page,
.nb-app[data-tool="shape"] .nb-page,
.nb-app[data-tool="eraser"] .nb-page,
.nb-app[data-tool="select"] .nb-page { touch-action: none; }
.nb-app[data-tool="type"] .nb-page { cursor: text; }
.nb-app[data-tool="pen"] .nb-page,
.nb-app[data-tool="highlighter"] .nb-page,
.nb-app[data-tool="shape"] .nb-page { cursor: crosshair; }
.nb-app[data-tool="eraser"] .nb-page { cursor: cell; }
.nb-app[data-tool="select"] .nb-page { cursor: default; }

/* Beim Zeichnen gehen Zeiger-Ereignisse durch die Elemente hindurch an die Seite. */
.nb-app:not([data-tool="type"]) .nb-items,
.nb-app:not([data-tool="type"]) .nb-page-header { pointer-events: none; }

.nb-page-header {
  position: absolute;
  left: 60px;
  top: 36px;
  width: min(720px, calc(100% - 120px));
  z-index: 2;
}
.nb-title {
  width: 100%;
  padding: 0 0 6px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--nb-text) 30%, transparent);
  outline: 0;
  background: transparent;
  color: var(--nb-text);
  font-family: var(--nb-font);
  font-size: 30px;
  font-weight: 400;
}
.nb-title::placeholder { color: color-mix(in srgb, var(--nb-text) 35%, transparent); }
.nb-date { margin-top: 8px; font-size: 13px; color: var(--nb-muted); }

.nb-items { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.nb-items > * { pointer-events: auto; }

.nb-ink {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}
.nb-ink .nb-hl { opacity: 0.4; }
.nb-page:not(.nb-page-light) .nb-ink .nb-hl { opacity: 0.33; }
.nb-ink .selected { filter: drop-shadow(0 0 1.5px var(--nb-focus)); }

.nb-sel-rect {
  display: none;
  position: absolute;
  z-index: 5;
  border: 1px solid var(--nb-focus);
  background: color-mix(in srgb, var(--nb-focus) 10%, transparent);
  pointer-events: none;
}
.nb-sel-box {
  display: none;
  position: absolute;
  z-index: 4;
  border: 1px dashed var(--nb-focus);
  pointer-events: none;
}

/* Notizcontainer wie in OneNote: Rahmen + Griffleiste nur beim Darüberfahren */
.nb-item {
  position: absolute;
  min-width: 40px;
  border: 1px solid transparent;
}
.nb-item-bar {
  position: absolute;
  left: -1px;
  right: -1px;
  top: -14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid color-mix(in srgb, var(--nb-text) 25%, transparent);
  border-bottom: 0;
  background: color-mix(in srgb, var(--nb-text) 7%, var(--nb-page-default));
  opacity: 0;
}
.nb-grip {
  flex: 1;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--nb-muted);
  cursor: move;
  touch-action: none;
}
.nb-grip svg { width: 12px; height: 12px; }
.nb-item-del {
  width: 16px;
  height: 13px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--nb-muted) !important;
  cursor: pointer;
  line-height: 1;
  font-size: 13px !important;
}
.nb-item-del:hover { color: #e03131 !important; }
.nb-item:hover, .nb-item.editing { border-color: color-mix(in srgb, var(--nb-text) 25%, transparent); }
.nb-item:hover .nb-item-bar, .nb-item.editing .nb-item-bar { opacity: 1; }
.nb-item.dragging { opacity: 0.85; }
.nb-item.selected { border-color: var(--nb-focus); }

.nb-resize { position: absolute; z-index: 2; touch-action: none; }
.nb-resize-side { top: 0; right: -5px; width: 10px; height: 100%; cursor: ew-resize; }
.nb-resize-corner {
  right: -5px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: var(--nb-page-default);
  border: 1px solid var(--nb-muted);
  cursor: nwse-resize;
  opacity: 0;
}
.nb-item:hover .nb-resize-corner { opacity: 1; }

.nb-text-body {
  min-height: 24px;
  padding: 3px 6px;
  outline: 0;
  font-family: var(--nb-font);
  font-size: 12pt;
  line-height: 1.45;
  color: var(--nb-text);
  overflow-wrap: anywhere;
  cursor: text;
}
.nb-item.editing .nb-text-body:empty::before { content: "Tippen…"; color: var(--nb-muted); }
.nb-text-body h1 { font-size: 1.6em; margin: 0.25em 0 0.15em; font-weight: 600; }
.nb-text-body h2 { font-size: 1.3em; margin: 0.25em 0 0.15em; font-weight: 600; color: #2f6fdb; }
body.dark .nb-page:not(.nb-page-light) .nb-text-body h2 { color: #7aa7ff; }
.nb-text-body h3 { font-size: 1.1em; margin: 0.25em 0 0.15em; font-weight: 600; }
.nb-text-body p { margin: 0; }
.nb-text-body ul, .nb-text-body ol { margin: 0.1em 0; padding-left: 1.5em; }
.nb-text-body blockquote {
  margin: 0.25em 0;
  padding: 0 0 0 0.8em;
  border-left: 3px solid color-mix(in srgb, var(--nb-text) 25%, transparent);
  color: var(--nb-muted);
}
.nb-text-body pre {
  margin: 0.25em 0;
  padding: 0.5em 0.7em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--nb-text) 6%, transparent);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 0.9em;
  white-space: pre-wrap;
}
.nb-text-body a { color: var(--nb-focus); text-decoration: underline; }
.nb-text-body hr { border: 0; border-top: 1px solid color-mix(in srgb, var(--nb-text) 25%, transparent); margin: 0.6em 0; }
.nb-text-body img { max-width: 100%; }

.nb-table { border-collapse: collapse; margin: 0.3em 0; min-width: 240px; }
.nb-table td, .nb-table th {
  min-width: 80px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--nb-text) 30%, transparent);
  vertical-align: top;
}

.nb-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-right: 3px;
  vertical-align: -2px;
  user-select: none;
  font-size: 12px;
  line-height: 1;
}
.nb-tag-todo {
  border: 1.5px solid color-mix(in srgb, var(--nb-text) 60%, transparent);
  border-radius: 2px;
  cursor: pointer;
}
.nb-tag-todo[data-checked="true"] { background: #2f6fdb; border-color: #2f6fdb; }
.nb-tag-todo[data-checked="true"]::after { content: "✓"; color: #fff; font-weight: 700; font-size: 11px; }
.nb-tag-important::after { content: "★"; color: #f0a800; font-size: 15px; }
.nb-tag-question { background: #7048e8; border-radius: 50%; }
.nb-tag-question::after { content: "?"; color: #fff; font-weight: 700; font-size: 11px; }
.nb-tag-idea::after { content: "💡"; font-size: 13px; }

.nb-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

.nb-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  min-width: 220px;
  border: 1px solid color-mix(in srgb, var(--nb-text) 18%, transparent);
  border-radius: 4px;
  background: var(--nb-page-default);
  color: var(--nb-text);
  text-decoration: none;
}
.nb-file-card:hover { background: color-mix(in srgb, var(--nb-text) 5%, var(--nb-page-default)); }
.nb-file-ext {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 40px;
  border-radius: 3px;
  background: #2f6fdb;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.nb-file-info { display: flex; flex-direction: column; min-width: 0; }
.nb-file-info strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.nb-file-info small { font-size: 12px; color: var(--nb-muted); }

/* PDF-Ausdruck: wirkt wie Papier, Klicks gehen auf die Seite (Text darüber tippen),
   verschieben/löschen über das Auswahl-Werkzeug */
.nb-item.nb-printout { pointer-events: none !important; border-color: transparent !important; }
.nb-item.nb-printout .nb-item-bar, .nb-item.nb-printout .nb-resize { display: none; }
.nb-item.nb-printout img {
  border-radius: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.nb-item.nb-printout.selected img { box-shadow: 0 0 0 2px var(--nb-focus); }

/* Leerer Zustand */
.nb-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.nb-empty[hidden] { display: none; }
.nb-empty-card { max-width: 340px; text-align: center; color: var(--nb-muted); }
.nb-empty-card svg { display: none; }
.nb-empty-card h3 { margin: 0 0 6px; font-size: 16px; color: var(--nb-strong); font-weight: 600; }
.nb-empty-card p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; }
.nb-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--nb-line);
  border-radius: 4px;
  background: var(--nb-page-default);
  color: var(--nb-strong) !important;
  font-size: 14px;
  cursor: pointer;
}
.nb-primary:hover { background: var(--nb-hover); }

/* ── Menüs & Popover ────────────────────────────────────────────────────── */
.nb-menu, .nb-pop {
  position: fixed;
  z-index: 15000;
  min-width: 220px;
  padding: 4px;
  border: 1px solid var(--nb-line);
  border-radius: 8px;
  background: var(--nb-pop);
  color: var(--nb-text);
  box-shadow: var(--nb-shadow);
  font-family: var(--nb-font);
}
.nb-menu[hidden], .nb-pop[hidden] { display: none; }
.nb-menu-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--nb-text) !important;
  cursor: pointer;
  text-align: left;
  font-size: 14px !important;
}
.nb-menu-item > span:not(.nb-menu-color) { flex: 1; }
.nb-menu-item:hover:not(:disabled) { background: var(--nb-hover); }
.nb-menu-item:disabled { opacity: 0.4; cursor: default; }
.nb-menu-item.active { font-weight: 600; }
.nb-menu-item.danger { color: #e03131 !important; }
.nb-menu-color { width: 10px; height: 14px; border-radius: 2px; flex-shrink: 0; }
.nb-menu-arrow { flex: 0 !important; color: var(--nb-muted); }
.nb-menu-sep { height: 1px; margin: 4px 0; background: var(--nb-line); }
.nb-menu-header { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--nb-muted); }
.nb-submenu {
  display: none;
  position: absolute;
  left: calc(100% + 2px);
  top: -5px;
  max-height: 60vh;
  overflow-y: auto;
}
.nb-menu-item.has-sub:hover > .nb-submenu, .nb-menu-item.has-sub.open > .nb-submenu { display: block; }

.nb-pop { min-width: 0; padding: 10px; }
.nb-pop-title { font-size: 12.5px; color: var(--nb-muted); margin-bottom: 8px; }
.nb-pop-swatches { display: grid; grid-template-columns: repeat(6, 22px); gap: 7px; }
.nb-table-grid { display: grid; grid-template-columns: repeat(8, 18px); gap: 2px; }
.nb-table-grid span {
  width: 18px;
  height: 18px;
  border: 1px solid var(--nb-line);
  cursor: pointer;
}
.nb-table-grid span.on { background: color-mix(in srgb, var(--nb-focus) 30%, transparent); border-color: var(--nb-focus); }

/* ── Notizen-Modus: volle Fläche ────────────────────────────────────────── */
@media (min-width: 981px) {
  .main-panel.notes-mode {
    grid-template-rows: minmax(0, 1fr) !important;
    gap: 0 !important;
    padding: 8px 8px 8px 8px !important;
  }
  .main-panel.notes-mode > .toolbar { display: none !important; }
  .main-panel.notes-mode .notes-view { height: 100%; min-height: 0; }
  .main-panel.notes-mode .nb-app { height: 100%; }
}

/* ── Eingeklappte App-Leiste als saubere Icon-Leiste ─────────────────────
   (vorher schaute je nach Breite "Suchen" abgeschnitten heraus) */
body.sidebar-collapsed .sidebar {
  align-items: center !important;
  justify-items: center !important;
  align-content: start !important;
  gap: 4px !important;
}
body.sidebar-collapsed .sidebar > * { justify-self: center !important; }
body.sidebar-collapsed .sidebar .sidebar-top {
  padding: 0 !important;
  margin: 0 0 8px !important;
  align-items: center !important;
  gap: 6px !important;
}
body.sidebar-collapsed .sidebar .sidebar-top > div { justify-content: center; }
body.sidebar-collapsed .sidebar .sidebar-search-trigger,
body.sidebar-collapsed .sidebar .new-chat,
body.sidebar-collapsed .sidebar .sidebar-mode-switch {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  max-height: none !important;
  transform: none !important;
  pointer-events: auto !important;
  overflow: visible !important;
}
body.sidebar-collapsed .sidebar .sidebar-mode-switch {
  flex-direction: column !important;
  align-items: center !important;
  gap: 2px !important;
  width: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
}
body.sidebar-collapsed .sidebar .sidebar-search-trigger,
body.sidebar-collapsed .sidebar .new-chat,
body.sidebar-collapsed .sidebar .mode-chip {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  margin: 2px 0 0 !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0 !important;
  border-radius: 8px !important;
}
body.sidebar-collapsed .sidebar .sidebar-search-trigger > span,
body.sidebar-collapsed .sidebar .new-chat > span,
body.sidebar-collapsed .sidebar .mode-chip > span {
  display: none !important;
}
body.sidebar-collapsed .sidebar .sidebar-search-trigger .nav-icon,
body.sidebar-collapsed .sidebar .new-chat .nav-icon,
body.sidebar-collapsed .sidebar .mode-chip .nav-icon {
  width: 18px;
  height: 18px;
  margin: 0 !important;
}
body.sidebar-collapsed .sidebar .sidebar-search-trigger,
body.sidebar-collapsed .sidebar .new-chat,
body.sidebar-collapsed .sidebar .mode-chip { margin: 0 !important; }
body.sidebar-collapsed .sidebar .sidebar-mode-switch {
  gap: 4px !important;
  margin: 0 !important;
  padding-top: 8px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 0 !important;
}
body:not(.dark).sidebar-collapsed .sidebar .sidebar-mode-switch { border-top-color: rgba(0, 0, 0, 0.08) !important; }
body.sidebar-collapsed .sidebar .sidebar-section,
body.sidebar-collapsed .sidebar .chat-search,
body.sidebar-collapsed .sidebar .sidebar-foot {
  display: none !important;
}

/* ── Responsiv ──────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .nb-nav { width: 400px; min-width: 400px; }
  .nb-app.nb-nav-collapsed .nb-nav { margin-left: -401px; }
  .nb-panes { grid-template-columns: 160px 1fr; }
}

/* Schmale Fenster: Navigation kompakter, damit die Seite genug Platz hat */
@media (max-width: 1100px) and (min-width: 821px) {
  .nb-nav { width: 330px; min-width: 330px; }
  .nb-app.nb-nav-collapsed .nb-nav { margin-left: -331px; }
  .nb-panes { grid-template-columns: 128px 1fr; }
  .nb-section { gap: 8px; padding: 0 6px 0 8px; font-size: 13.5px; }
  .nb-count { display: none; }
  .nb-page-title { font-size: 13.5px; }
  .nb-notebook-btn { font-size: 15px; }
  .nb-page-header { left: 32px; width: calc(100% - 64px); }
  .nb-rb > span:not(.nb-color-a) { display: none; }
  .nb-font { width: 120px; }
}

@media (max-width: 820px) {
  .nb-app {
    height: calc(100vh - 76px);
    height: calc(100dvh - 76px);
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .nb-nav, .nb-app.nb-nav-collapsed .nb-nav { width: 100%; min-width: 0; margin-left: 0; border-right: 0; }
  .nb-panes { grid-template-columns: 38% 1fr; }
  .nb-main { display: none; }
  .nb-app.nb-show-page .nb-nav { display: none; }
  .nb-app.nb-show-page .nb-main { display: flex; }
  .nb-back { display: inline-flex; }
  .nb-nav-toggle, .nb-save-state { display: none; }
  .nb-share select { max-width: 100px; }
  .nb-page-header { left: 20px; width: calc(100% - 40px); }
  .nb-title { font-size: 24px; }
  .nb-page-more, .nb-item-bar { opacity: 1; }
  [data-act="toggleNav"] { display: none !important; }
}

/* ── Malmodus: Vollbild mit schwebender Stift-Leiste ─────────────────────── */
.nb-draw-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--nb-line);
  border-radius: 4px;
  background: var(--nb-page-default);
  color: var(--nb-strong) !important;
  font-size: 13px;
  cursor: pointer;
}
.nb-draw-btn:hover { border-color: var(--nb-faint); }

.nb-app:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
}
.nb-app.nb-fs-fallback {
  position: fixed;
  inset: 0;
  z-index: 20000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  border: 0;
  border-radius: 0;
}
.nb-app.nb-draw-mode .nb-nav,
.nb-app.nb-draw-mode .nb-topbar,
.nb-app.nb-draw-mode .nb-tabs,
.nb-app.nb-draw-mode .nb-ribbon { display: none !important; }
.nb-app.nb-draw-mode .nb-main { display: flex !important; }
.nb-app.nb-draw-mode .nb-scroll { margin-top: 0; border-top: 0; }

.nb-drawbar {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: calc(100% - 24px);
  padding: 6px;
  border: 1px solid var(--nb-line);
  border-radius: 14px;
  background: var(--nb-pop);
  box-shadow: var(--nb-shadow);
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
  user-select: none;
}
.nb-drawbar::-webkit-scrollbar { display: none; }
.nb-drawbar[hidden] { display: none; }
.nb-db-sep { width: 1px; height: 28px; margin: 0 4px; background: var(--nb-line); flex-shrink: 0; }
.nb-db-sep[hidden] { display: none; }

.nb-db-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--nb-strong) !important;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.nb-db-btn:hover { background: var(--nb-hover); }
.nb-db-btn.active { background: var(--nb-active); box-shadow: inset 0 0 0 1px var(--nb-line); }
.nb-app[data-tool] .nb-db-btn[data-tool].active { background: color-mix(in srgb, var(--nb-focus) 22%, transparent); color: var(--nb-focus) !important; box-shadow: none; }
.nb-db-exit { font-weight: 600; }
.nb-db-zoom { min-width: 58px; font-variant-numeric: tabular-nums; font-size: 13px; }
.nb-db-finger span { font-size: 13px; white-space: nowrap; }

.nb-db-swatches { display: flex; align-items: center; gap: 6px; padding: 0 4px; flex-shrink: 0; }
.nb-db-swatches[hidden] { display: none; }
.nb-db-swatch { width: 30px; height: 30px; }
.nb-db-widths { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.nb-db-width i {
  display: block;
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: var(--nb-strong);
}
.nb-db-shapes { display: flex; gap: 4px; }

/* Im Malmodus nimmt der Stift ganz die Kontrolle: kein Textmarkieren, kein Kontextmenü */
.nb-app.nb-draw-mode .nb-page { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

@media (max-width: 820px) {
  .nb-draw-btn span, .nb-db-exit span, .nb-db-finger span { display: none; }
  .nb-db-btn { min-width: 40px; height: 40px; padding: 0 6px; }
  .nb-db-swatch { width: 26px; height: 26px; }
}

/* Im Malmodus übernimmt die App alle Gesten: Browser darf nichts scrollen/zoomen */
.nb-app.nb-draw-mode .nb-scroll,
.nb-app.nb-draw-mode .nb-page {
  touch-action: none !important;
  overscroll-behavior: none;
}

/* Fingermodus-Auswahl */
.nb-fm-list { display: flex; flex-direction: column; gap: 4px; width: 280px; }
.nb-fm-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--nb-text) !important;
  text-align: left;
  cursor: pointer;
}
.nb-fm-opt strong { font-size: 14px; font-weight: 600; }
.nb-fm-opt small { font-size: 12.5px; color: var(--nb-muted); line-height: 1.35; }
.nb-fm-opt:hover { background: var(--nb-hover); }
.nb-fm-opt.active { border-color: var(--nb-focus); background: color-mix(in srgb, var(--nb-focus) 10%, transparent); }

/* Vorlagen zum Abzeichnen */
.nb-item.nb-template { pointer-events: none !important; border-color: transparent !important; }
.nb-item.nb-template .nb-item-bar, .nb-item.nb-template .nb-resize { display: none; }
.nb-item.nb-template.selected { outline: 2px dashed var(--nb-focus); outline-offset: 2px; }
.nb-item.nb-template img { object-fit: contain; }

.nb-tpl {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 45;
  width: min(380px, calc(100% - 24px));
  max-height: calc(100% - 110px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--nb-line);
  border-radius: 12px;
  background: var(--nb-pop);
  color: var(--nb-text);
  box-shadow: var(--nb-shadow);
  overflow: hidden;
}
.nb-tpl[hidden] { display: none; }
.nb-tpl-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 14px; font-size: 15px; }
.nb-tpl-active {
  margin: 0 12px 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--nb-field);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.nb-tpl-active[hidden] { display: none; }
.nb-tpl-active label { display: grid; grid-template-columns: 70px 1fr; align-items: center; color: var(--nb-muted); }
.nb-tpl-active input[type=range] { width: 100%; accent-color: var(--nb-focus); height: 28px; }
.nb-tpl-actions { display: flex; justify-content: space-between; align-items: center; }
.nb-tpl-hint { margin: 0; font-size: 12px; color: var(--nb-muted); line-height: 1.4; }
.nb-danger-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, #e03131 45%, transparent);
  border-radius: 6px;
  background: transparent;
  color: #e03131 !important;
  font-size: 13.5px;
  cursor: pointer;
}
.nb-danger-btn:hover { background: rgba(224, 49, 49, 0.1); }
.nb-tpl-search { display: flex; gap: 4px; padding: 0 12px; }
.nb-tpl-search input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--nb-line);
  border-radius: 8px;
  background: var(--nb-page-default);
  color: var(--nb-strong);
  font-size: 15px;
  outline: 0;
}
.nb-tpl-search input:focus { border-color: var(--nb-focus); }
.nb-tpl-search .nb-db-btn { height: 40px; min-width: 40px; }
.nb-tpl-chips { display: flex; gap: 6px; padding: 8px 12px; flex-wrap: wrap; }
.nb-tpl-chips button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--nb-line);
  border-radius: 999px;
  background: transparent;
  color: var(--nb-text) !important;
  font-size: 13px;
  cursor: pointer;
}
.nb-tpl-chips button.active { border-color: var(--nb-focus); color: var(--nb-focus) !important; }
.nb-tpl-grid {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 104px;
  gap: 6px;
  padding: 0 12px 8px;
  align-content: start;
}
.nb-tpl-grid .nb-muted { grid-column: 1 / -1; margin: 6px 2px; align-self: start; }
.nb-tpl-thumb {
  height: 100%;
  padding: 0;
  border: 1px solid var(--nb-line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
}
.nb-tpl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nb-tpl-thumb:hover { outline: 2px solid var(--nb-focus); outline-offset: -2px; }
.nb-tpl-foot { padding: 8px 12px 10px; border-top: 1px solid var(--nb-line); }
.nb-db-tpl span { font-size: 13px; }
@media (max-width: 820px) { .nb-db-tpl span { display: none; } }

/* ── Stiftkasten ─────────────────────────────────────────────────────────── */
.nb-app { --nb-pen-body: #3a3a3a; }
body.dark .nb-app { --nb-pen-body: #d6d6d6; }

.nb-pen-tray { display: flex; align-items: flex-end; gap: 2px; padding: 0 2px; flex-shrink: 0; }
.nb-pen {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  width: 30px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.12s ease;
}
.nb-pen .nb-pen-svg { transform: translateY(8px); transition: transform 0.15s ease; }
.nb-pen:hover .nb-pen-svg { transform: translateY(4px); }
.nb-pen.active .nb-pen-svg { transform: translateY(0); }
.nb-pen.active::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--nb-focus);
}
.nb-pen-add {
  align-items: center;
  color: var(--nb-muted) !important;
  border-radius: 6px;
}
.nb-pen-add:hover { background: var(--nb-hover); color: var(--nb-strong) !important; }
.nb-pen-tray-lg .nb-pen { width: 36px; height: 44px; }
.nb-pen-tray-lg .nb-pen .nb-pen-svg { transform: translateY(12px); }
.nb-pen-tray-lg .nb-pen:hover .nb-pen-svg { transform: translateY(7px); }
.nb-pen-tray-lg .nb-pen.active .nb-pen-svg { transform: translateY(2px); }

/* Stift-Effekte */
.nb-ink .nb-pencil { filter: url(#nbPencilTex); opacity: 0.9; }
.nb-ink .nb-neon, .nb-pen-preview-svg .nb-neon { filter: drop-shadow(0 0 2px currentColor) drop-shadow(0 0 6px currentColor); }
.nb-ink .nb-felt { opacity: 0.94; }
.nb-pen-preview-svg .nb-pencil { filter: url(#nbPencilTex); }
.nb-pen-preview-svg .nb-hl { opacity: 0.45; }

/* Stift-Editor */
.nb-pen-editor { width: 300px; display: flex; flex-direction: column; gap: 6px; }
.nb-pe-preview {
  display: flex;
  justify-content: center;
  padding: 6px 0;
  border-radius: 8px;
  background: var(--nb-page-default);
  border: 1px solid var(--nb-line);
  --nb-ink: var(--nb-text);
}
.nb-pe-label { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--nb-muted); }
.nb-pe-label span { font-weight: 400; font-variant-numeric: tabular-nums; }
.nb-pe-brushes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.nb-brush {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px 6px;
  border: 1px solid var(--nb-line);
  border-radius: 8px;
  background: transparent;
  color: var(--nb-text) !important;
  cursor: pointer;
  overflow: hidden;
}
.nb-brush svg { width: 100%; height: 26px; }
.nb-brush span { font-size: 10.5px; white-space: nowrap; }
.nb-brush:hover { background: var(--nb-hover); }
.nb-brush.active { border-color: var(--nb-focus); background: color-mix(in srgb, var(--nb-focus) 10%, transparent); }
.nb-pe-width { width: 100%; height: 30px; accent-color: var(--nb-focus); }

/* Farbwähler: Sättigung/Helligkeit-Feld + Farbton-Regler */
.nb-cp { display: flex; flex-direction: column; gap: 8px; }
.nb-cp-sv {
  --hue: 220;
  position: relative;
  height: 130px;
  border-radius: 8px;
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, hsl(var(--hue) 100% 50%));
  cursor: crosshair;
  touch-action: none;
}
.nb-cp-knob {
  position: absolute;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.nb-cp-hue {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  outline: 0;
}
.nb-cp-hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.nb-cp-hue::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.nb-cp-row { display: flex; align-items: center; gap: 8px; }
.nb-cp-hex {
  flex: 1;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--nb-line);
  border-radius: 6px;
  background: var(--nb-page-default);
  color: var(--nb-strong);
  font-family: Consolas, monospace;
  font-size: 13px;
  outline: 0;
}
.nb-cp-hex:focus { border-color: var(--nb-focus); }
.nb-pe-palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; justify-items: center; }
.nb-pe-palette .nb-swatch { width: 26px; height: 26px; }
.nb-pe-actions { display: flex; justify-content: space-between; margin-top: 8px; }
.nb-pe-actions .nb-danger-btn:disabled { opacity: 0.4; cursor: default; }
.nb-pop:has(.nb-pen-editor) { max-height: calc(100vh - 24px); overflow-y: auto; }

.nb-db-widths[hidden] { display: none; }

/* Online-Bilder: Umschalter im Panel + Bildnachweis */
.nb-tpl-mode {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 2px;
  margin: 0 12px 10px;
  padding: 3px;
  border-radius: 8px;
  background: var(--nb-field);
}
.nb-tpl-mode button {
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--nb-muted) !important;
  font-size: 13px;
  cursor: pointer;
}
.nb-tpl-mode button.active { background: var(--nb-page-default); color: var(--nb-strong) !important; font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.nb-credit {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  padding-top: 3px;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--nb-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Radierer-Kreis (zeigt Grösse & Position, gestrichelt = teilweise radieren) */
.nb-eraser-cursor {
  display: none;
  position: absolute;
  z-index: 6;
  border: 1.5px solid var(--nb-muted);
  border-radius: 50%;
  background: color-mix(in srgb, var(--nb-page-default) 40%, transparent);
  pointer-events: none;
}
.nb-eraser-cursor.partial { border-style: dashed; border-color: var(--nb-focus); }
.nb-app[data-tool="eraser"] .nb-page { cursor: none; }

/* Pipette */
.nb-app.nb-picking .nb-page,
.nb-app.nb-picking .nb-page * { cursor: crosshair !important; }
.nb-cp-pipette {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border: 1px solid var(--nb-line);
  border-radius: 6px;
  background: var(--nb-page-default);
  color: var(--nb-strong) !important;
  cursor: pointer;
}
.nb-cp-pipette:hover { border-color: var(--nb-focus); color: var(--nb-focus) !important; }
.nb-db-swatches .nb-db-btn span { font-size: 13px; }

/* Leiste über einer Auswahl: Farbe/Dicke/Stiftart nachträglich ändern */
.nb-selbar {
  position: absolute;
  z-index: 42;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  border: 1px solid var(--nb-line);
  border-radius: 10px;
  background: var(--nb-pop);
  box-shadow: var(--nb-shadow);
  max-width: calc(100% - 16px);
  overflow-x: auto;
  scrollbar-width: none;
}
.nb-selbar[hidden] { display: none; }
.nb-sb-colors { display: flex; align-items: center; gap: 5px; padding: 0 2px; }
.nb-sb-colors .nb-swatch { width: 24px; height: 24px; }
.nb-sb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--nb-strong) !important;
  cursor: pointer;
  flex-shrink: 0;
}
.nb-sb-btn:hover { background: var(--nb-hover); }
.nb-sb-danger:hover { background: rgba(224, 49, 49, 0.12); color: #e03131 !important; }
.nb-sb-width { display: flex; align-items: center; gap: 6px; color: var(--nb-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.nb-sb-width input { width: 96px; accent-color: var(--nb-focus); }
.nb-sb-width span { min-width: 26px; }
.nb-sb-brush { height: 30px; font-size: 12.5px; }
