/* ---------- Ablage (ab-*) ---------- */
#ab-overlay { padding: 0; align-items: stretch; justify-content: center; background: var(--bg); }
#ab-overlay .ku-modal {
  max-width: 1180px; width: 100%; max-height: none; height: 100%;
  border: none; border-radius: 0; background: var(--bg);
  padding: 0 1.25rem calc(2rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: none; touch-action: pan-y;
}
#ab-overlay .back-link { display: none; }

.ab-top { display: flex; flex-direction: column; gap: 10px; margin: 0 0 1rem; }
.ab-searchrow { display: flex; gap: 8px; }
.ab-q { flex: 1; min-width: 0; font-size: 15px; padding: 11px 12px; }
.ab-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ab-stats { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.toolbar-btn.ab-primary { background: var(--accent); color: var(--accent-ink); }
.toolbar-btn.ab-primary:hover { background: var(--accent-2); color: var(--accent-ink); }
a.toolbar-btn { display: inline-flex; align-items: center; text-decoration: none; }
.toolbar-btn:disabled { opacity: .55; cursor: default; }

.ab-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 22px; align-items: start; }
.ab-tree { position: sticky; top: calc(70px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 100px); overflow-y: auto; padding: 4px 0 20px; border-right: 1px solid var(--border); }
.ab-node { display: flex; align-items: center; padding-left: calc(var(--d) * 14px); }
.ab-twist, .ab-twist-pad { flex: 0 0 22px; width: 22px; height: 30px; }
.ab-twist { border: none; background: none; color: var(--text-faint); cursor: pointer; font-size: 11px; padding: 0; }
.ab-twist:hover { color: var(--text); }
.ab-node-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: none; background: none; color: var(--text-muted); font: inherit; font-size: 13.5px; text-align: left; padding: 6px 10px 6px 4px; border-radius: var(--radius-sm); cursor: pointer; margin-right: 8px; }
.ab-node-btn:hover { background: var(--fill); color: var(--text); }
.ab-node.active .ab-node-btn { background: var(--fill-hover); color: var(--text); font-weight: 600; }
.ab-node-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-node-n { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ab-mega-dot { flex: 0 0 auto; font-size: 9.5px; font-weight: 700; line-height: 1; padding: 3px 4px; border-radius: 4px; background: #d9272e; color: #fff; }
.ab-tree-sep { height: 1px; background: var(--border); margin: 8px 8px 8px 22px; }
.ab-tree-empty { font-size: 12.5px; color: var(--text-faint); line-height: 1.5; padding: 6px 12px 6px 22px; }

.ab-main { min-width: 0; padding-bottom: 2rem; }
.ab-h { font-size: 20px; font-weight: 700; margin: 0 0 .35rem; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.ab-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12.5px; color: var(--text-faint); margin: 0 0 .5rem; }
.ab-crumb { border: none; background: none; color: var(--text-muted); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ab-crumb:hover { color: var(--text); }
.ab-sep { color: var(--text-faint); }
.ab-folder-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ab-folder-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ab-desc { font-size: 14px; line-height: 1.55; color: var(--text-muted); margin: .25rem 0 .5rem; max-width: 70ch; }

.ab-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: .9rem 0 1rem; }
.ab-sub { display: flex; flex-direction: column; gap: 4px; text-align: left; background: var(--bg-elevated-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 11px 13px; color: var(--text); font: inherit; cursor: pointer; }
.ab-sub:hover { border-color: var(--border-strong); background: var(--fill); }
.ab-sub-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.ab-sub-desc { font-size: 12px; color: var(--text-faint); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ab-sub-n { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ab-list-h { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-faint); margin: 1.1rem 0 .5rem; }

.ab-item { align-items: center; }
.ab-type { flex: 0 0 52px; align-self: flex-start; margin-top: 1px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .03em; padding: 6px 0; border-radius: var(--radius-sm); background: var(--fill); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.ab-type-video { background: rgba(109, 140, 255, .16); color: #8ea6ff; }
.ab-type-audio { background: rgba(176, 120, 255, .16); color: #c39bff; }
.ab-type-dokument { background: rgba(255, 178, 56, .14); color: var(--warning); }
.ab-type-link { background: rgba(62, 207, 142, .14); color: #3ecf8e; }
.ab-path { font-size: 12px; color: var(--text-faint); overflow-wrap: anywhere; }
.ab-meta { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ab-snippet { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.ab-snippet mark { background: var(--warning-soft); color: var(--text); border-radius: 3px; padding: 0 2px; }

.ab-item-head { display: flex; align-items: flex-start; gap: 12px; margin-top: .25rem; }
.ab-item-head .ab-h { margin: 0; }
.ab-summary { font-size: 14px; line-height: 1.6; color: var(--text); background: var(--bg-elevated-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin: 1rem 0 0; max-width: 75ch; }
.ab-form { margin-top: 1rem; }
.ab-form .cs-label:first-child { margin-top: 0; }
.ab-folder-row { display: flex; gap: 8px; }
.ab-folder-row .cs-input { flex: 1; min-width: 0; }
.ab-text { max-height: 520px; font-size: 13px; }
.ab-inline-hint { display: inline-block; margin: 0 0 0 10px; }
.ab-bar { display: block; height: 4px; background: var(--fill); border-radius: 4px; overflow: hidden; }
.ab-bar > span { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }

.ab-answer { font-size: 14.5px; line-height: 1.65; background: var(--bg-elevated-2); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 14px 16px; margin: .75rem 0; max-width: 78ch; overflow-wrap: anywhere; }
.ab-loading { color: var(--text-muted); }
.ab-cite { border: 1px solid var(--border-strong); background: var(--fill); color: var(--text); font: inherit; font-size: 11.5px; font-weight: 600; padding: 0 5px; border-radius: 4px; cursor: pointer; vertical-align: 1px; }
.ab-cite:hover { background: var(--fill-hover); }

.ab-uploads { display: flex; flex-direction: column; gap: 8px; background: var(--bg-elevated-2); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 12px 14px; margin: 0 0 1rem; }
.ab-up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; }
.ab-up .ab-bar { grid-column: 1 / -1; }
.ab-up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-up-st { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ab-up-err .ab-up-st { color: var(--danger); white-space: normal; }

.ab-drop { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .6); pointer-events: none; }
.ab-drop > div { border: 2px dashed var(--accent); border-radius: var(--radius-lg); padding: 40px 50px; font-size: 17px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, .4); }

.ab-dlg { max-width: 520px; }
.ab-dlg .cs-hint { margin-top: 2px; }
.ab-dlg-err { margin-top: 10px; font-size: 13px; color: var(--danger); line-height: 1.45; }
.ab-dlg-actions { margin-top: 16px; }
.ab-dlg-del { margin-right: auto; }

@media (max-width: 760px) {
  .ab-layout { grid-template-columns: 1fr; gap: 12px; }
  .ab-tree { position: static; max-height: 42vh; border-right: none; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 6px 0; }
  .ab-searchrow { flex-direction: column; }
  .ab-item { flex-direction: row; flex-wrap: wrap; }
  .ab-item .cs-item-main { flex: 1 1 calc(100% - 60px); }
  .ab-item .cs-item-tags { flex-basis: 100%; max-width: none; justify-content: flex-start; padding-left: 56px; }
  .ab-item .cs-item-tags:empty { display: none; }
  .ab-type { flex-basis: 44px; }
  .ab-folder-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .ab-bar > span { transition: none; } }
#ab-overlay { height: 100vh; height: 100dvh; inset: 0 0 auto 0; }
/* Mac-App: klickbar/scrollbar halten (der Body ist dort ein Zieh-Bereich) */
#ab-overlay, #ab-overlay * { -webkit-app-region: no-drag; }
.ab-drop[hidden], .ab-uploads[hidden], .ab-dlg-err[hidden] { display: none; }
.ab-up-sum { font-size: 13px; font-weight: 600; }
