/* =================================================================
 * vault.css — DO NOT MERGE INTO styles.css
 *
 * All styles for the Hydro Knowledge Vault dialog. Kept separate so
 * that careless edits to styles.css cannot strip the vault UI.
 *
 * Integrity sentinel: backend/scripts/verify-vault-integrity.sh greps
 * for "VAULT_CSS_SENTINEL_v1" below. Do not remove it.
 *
 * /* VAULT_CSS_SENTINEL_v1 */
 * ================================================================= */

/* ---------- Full-screen + drag-resize overrides (additive) ----------
   The vault dialog opens edge-to-edge and the three panes (tree, note,
   graph) are sized via CSS variables that the resizers update from JS.
   Users can drag the splitters to any size; double-click resets. */
.vault-dialog[open] {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #161616 !important;
  display: flex !important;
}
.vault-shell {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
.vault-shell:fullscreen,
.vault-graph-frame:fullscreen,
.vault-graph-pane:fullscreen {
  width: 100vw !important;
  height: 100dvh !important;
  background: #161616 !important;
}
.vault-icon-btn.is-active {
  color: #fff;
  background: rgba(122, 162, 247, 0.18);
}
.vault-layout {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: grid !important;
  /* `--vault-tree-w` / `--vault-graph-w` are written by attachResizer()
     in vault.js as the user drags the splitters. Defaults match the
     historical layout but users can size each pane to anything. */
  grid-template-columns:
    var(--vault-tree-w, 260px)
    6px
    minmax(0, 1fr)
    6px
    var(--vault-graph-w, 360px) !important;
  grid-template-rows: 1fr !important;
  gap: 0 !important;
}
.vault-shell.is-tree-collapsed .vault-layout { grid-template-columns: 0 0 minmax(0,1fr) 6px var(--vault-graph-w,360px) !important; }
.vault-shell.is-graph-collapsed .vault-layout { grid-template-columns: var(--vault-tree-w,260px) 6px minmax(0,1fr) 0 0 !important; }
.vault-shell.is-tree-collapsed.is-graph-collapsed .vault-layout { grid-template-columns: 0 0 minmax(0,1fr) 0 0 !important; }
.vault-resizer {
  width: 6px !important;
  cursor: col-resize !important;
  background: transparent !important;
  position: relative !important;
  z-index: 2 !important;
  touch-action: none !important;
}
.vault-resizer::before {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  background: rgba(255,255,255,0.04) !important;
  transition: background 120ms !important;
}
.vault-resizer:hover::before,
.vault-resizer.is-dragging::before { background: rgba(122,162,247,0.30) !important; }
.vault-sidebar, .vault-note-pane, .vault-graph-pane {
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}
.vault-note-body { overflow: auto !important; }

.vault-line {
  position: relative;
  padding-right: 9.5rem;
}
.vault-line-actions {
  position: absolute;
  right: 0;
  top: 0.05rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.5;
  transition: opacity 120ms, transform 120ms;
}
.vault-line:hover > .vault-line-actions,
.vault-line:focus-within > .vault-line-actions,
.vault-note-body.show-line-tools .vault-line-actions {
  opacity: 1;
}
.vault-line-btn {
  appearance: none;
  border: 1px solid rgba(122, 162, 247, 0.35);
  background: rgba(31, 38, 58, 0.9);
  color: #d8e2ff;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
}
.vault-line-btn:hover { background: rgba(55, 69, 104, 0.95); color: #fff; }
.vault-line-btn.danger {
  border-color: rgba(247, 118, 142, 0.38);
  color: #ffc0cb;
}
.vault-line.is-editing {
  outline: 1px solid rgba(122, 162, 247, 0.35);
  outline-offset: 4px;
  border-radius: 6px;
}
.vault-line-editable {
  display: inline-block;
  min-width: min(100%, 18rem);
  max-width: 100%;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(16, 20, 31, 0.92);
  color: #edf2ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: 1px solid rgba(122, 162, 247, 0.45);
}
.vault-line-editor-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  vertical-align: middle;
}

@media (max-width: 760px) {
  .vault-line {
    padding-right: 0;
    padding-bottom: 1.7rem;
  }
  .vault-line-actions {
    top: auto;
    right: auto;
    left: 0;
    bottom: 0;
    opacity: 0.85;
  }
}

/* ---------- Original HEAD vault rules ---------- */
/* ---------- Hydro Knowledge Vault (Obsidian-like 3-pane) ---------- */

.vault-dialog {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  max-width: 100dvw;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #1e1e1e;
  color: #dcddde;
}
.vault-dialog::backdrop { background: rgba(0,0,0,0.6); }
.vault-dialog[open] { display: flex; }

.vault-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #1e1e1e;
  color: #dcddde;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.vault-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid #2a2a2a;
  background: #202020;
}
.vault-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.vault-title-name {
  font-size: 14px;
  font-weight: 600;
  color: #e6e6e6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-status {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.vault-bundle-pin {
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: rgba(224, 175, 104, 0.92);
  margin-top: 4px;
  line-height: 1.35;
}
.vault-icon-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px;
  border-radius: 6px;
  color: #c8c8c8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vault-icon-btn:hover { background: #2c2c2c; color: #fff; }
.vault-icon-btn:active { background: #383838; }

.vault-header-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: min(640px, 46vw);
}
.vault-mini-btn {
  appearance: none;
  border: 1px solid rgba(122, 162, 247, 0.42);
  background: rgba(31, 38, 58, 0.92);
  color: #e8ebff;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.vault-mini-btn:hover:not(:disabled) {
  background: rgba(55, 69, 104, 0.98);
  color: #fff;
}
.vault-mini-btn:disabled {
  opacity: 0.38;
  cursor: default;
}
.vault-mini-btn-gold {
  border-color: rgba(224, 175, 104, 0.65);
  color: #f8edd6;
}
.vault-mini-btn-gold:hover:not(:disabled) {
  border-color: rgba(224, 175, 104, 0.95);
  background: rgba(224, 175, 104, 0.2);
  color: #fff;
}

.vault-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns:
    var(--vault-tree-w, 240px)
    4px
    minmax(0, 1fr)
    4px
    var(--vault-graph-w, 320px);
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.vault-resizer {
  background: transparent;
  cursor: col-resize;
  position: relative;
  user-select: none;
  touch-action: none;
}
.vault-resizer::before {
  content: "";
  position: absolute;
  inset: 0 -3px;
  background: transparent;
  transition: background 120ms;
}
.vault-resizer:hover::before,
.vault-resizer.is-dragging::before { background: rgba(122, 162, 247, 0.22); }
.vault-resizer.is-dragging { background: rgba(122, 162, 247, 0.35); }

.vault-sidebar,
.vault-note-pane,
.vault-graph-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vault-sidebar { border-right: 1px solid #2a2a2a; background: #1a1a1a; }
.vault-graph-pane { border-left: 1px solid #2a2a2a; background: #181818; }

.vault-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #2a2a2a;
  background: #1c1c1c;
}
.vault-pane-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  padding: 10px 14px 6px;
}
.vault-graph-count { font-size: 11px; color: #777; }
.vault-path {
  font-size: 12px;
  color: #b8b8b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.vault-tree {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 6px 12px;
  font-size: 13px;
}
.vault-tree-dir > summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: #c8c8c8;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vault-tree-dir > summary::-webkit-details-marker { display: none; }
.vault-tree-dir > summary::before {
  content: "▸";
  font-size: 9px;
  color: #777;
  transition: transform 120ms;
  display: inline-block;
  width: 10px;
}
.vault-tree-dir[open] > summary::before { transform: rotate(90deg); }
.vault-tree-dir > summary:hover { background: #262626; color: #fff; }
.vault-tree-children { padding-left: 14px; }

.vault-tree-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding-right: 2px;
}
.vault-tree-row .vault-tree-file {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.vault-tree-file {
  appearance: none;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  width: 100%;
  padding: 4px 6px 4px 22px;
  border-radius: 4px;
  color: #b8b8b8;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-tree-file::before {
  content: "•";
  flex: 0 0 auto;
  color: #555;
  margin-left: -16px;
  margin-right: 2px;
}
.vault-tree-file-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vault-tree-status-icons {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  margin-left: auto;
}
.vault-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  opacity: 0.92;
}
.vault-status-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.vault-status-pdf-ok,
.vault-status-curation-curated {
  color: #9ece6a;
  background: rgba(158, 206, 106, 0.1);
}
.vault-status-pdf-missing,
.vault-status-curation-scaffold {
  color: #e0af68;
  background: rgba(224, 175, 104, 0.1);
}
.vault-status-pdf-blocked {
  color: #ff6b81;
  background: rgba(255, 107, 129, 0.11);
}
.vault-status-curation-partial {
  color: #7aa2f7;
  background: rgba(122, 162, 247, 0.11);
}
.vault-status-pdf-unknown,
.vault-status-curation-unknown {
  color: #8a8585;
  background: rgba(255, 255, 255, 0.06);
}
.vault-tree-file:hover { background: #262626; color: #e6e6e6; }
.vault-tree-file.is-active { background: #2d3a55; color: #fff; }
.vault-tree-file.is-active::before { color: #7aa2f7; }
.vault-tree-delete {
  flex: 0 0 auto;
  appearance: none;
  width: 28px;
  min-width: 28px;
  border: 0;
  padding: 0;
  align-self: center;
  margin-top: -1px;
  border-radius: 4px;
  background: transparent;
  color: #8a8585;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.75;
  transition: color 120ms, background 120ms, opacity 120ms;
}
.vault-tree-row:hover .vault-tree-delete {
  opacity: 1;
}
.vault-tree-delete:hover {
  color: #ff6b81;
  background: rgba(255, 107, 129, 0.12);
}

.vault-tree-pending-chip {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid rgba(224, 175, 104, 0.38);
  border-radius: 999px;
  color: #e0af68;
  font-size: 10px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vault-note-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px clamp(18px, 4vw, 56px) 80px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
  line-height: 1.65;
  color: #dcddde;
}
.vault-note-body h1,
.vault-note-body h2,
.vault-note-body h3,
.vault-note-body h4 {
  color: #fff;
  font-weight: 600;
  margin: 1.4em 0 0.4em;
  line-height: 1.25;
}
.vault-note-body h1 { font-size: 1.65em; border-bottom: 1px solid #2a2a2a; padding-bottom: 0.25em; }
.vault-note-body h2 { font-size: 1.35em; }
.vault-note-body h3 { font-size: 1.15em; }
.vault-note-body p { margin: 0.6em 0; }
.vault-note-body ul,
.vault-note-body ol { margin: 0.4em 0 0.8em 1.4em; }
.vault-note-body li { margin: 0.2em 0; }
.vault-note-body code {
  background: #2a2a2a;
  border-radius: 4px;
  padding: 0.1em 0.3em;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #e6cc7a;
}
.vault-note-body pre {
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0.8em 0;
}
.vault-note-body pre code { background: transparent; padding: 0; color: #dcddde; }
.vault-note-body blockquote {
  border-left: 3px solid #4a4a4a;
  padding: 0.2em 0 0.2em 14px;
  color: #b8b8b8;
  margin: 0.8em 0;
}
.vault-note-body hr { border: 0; border-top: 1px solid #2a2a2a; margin: 1.4em 0; }
.vault-note-body a { color: #7aa2f7; text-decoration: none; }
.vault-note-body a:hover { text-decoration: underline; }
.vault-note-body table { border-collapse: collapse; margin: 0.8em 0; font-size: 0.95em; }
.vault-note-body table th,
.vault-note-body table td { border: 1px solid #2a2a2a; padding: 6px 10px; }
.vault-note-body table th { background: #1c1c1c; }

.vault-link {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #a48bf7;
  text-decoration: underline dotted;
  cursor: pointer;
}
.vault-link:hover { color: #c8b4ff; text-decoration: underline; }
.vault-link.is-missing { color: #777; text-decoration: underline dotted #444; }

.vault-empty {
  color: #6a6a6a;
  padding: 12px 14px;
  font-size: 13px;
}

.vault-graph-frame {
  flex: 1 1 auto;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, #232323 0%, #181818 70%);
  position: relative;
  cursor: grab;
}
.vault-graph-pane:fullscreen {
  position: relative;
  display: block;
  border: 0;
  overflow: hidden;
  background: #141414 !important;
}
.vault-graph-pane:fullscreen .vault-pane-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(10px);
}
.vault-graph-pane:fullscreen .vault-graph-controls {
  position: absolute;
  top: 46px;
  left: 12px;
  z-index: 4;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - 62px);
  overflow: auto;
  border: 1px solid rgba(122, 162, 247, 0.22);
  border-radius: 12px;
  background: rgba(18, 18, 18, 0.82);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
}
.vault-graph-pane:fullscreen .vault-graph-frame {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 1;
}
.vault-graph-pane:fullscreen .vault-graph-canvas {
  width: 100vw;
  height: 100dvh;
}
.vault-graph-frame:fullscreen {
  display: block;
  padding: 0;
  margin: 0;
  cursor: grab;
}
.vault-graph-frame:fullscreen .vault-graph-canvas {
  width: 100vw;
  height: 100dvh;
}
.vault-graph-frame:active { cursor: grabbing; }
.vault-graph-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  background: transparent;
  animation: vault-graph-fade-in 400ms ease-out;
}
.vault-graph-canvas:active { cursor: grabbing; }
@keyframes vault-graph-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Floating tooltip shown on node hover */
.vault-graph-tooltip {
  position: absolute;
  z-index: 6;
  max-width: 240px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(20, 23, 28, 0.94);
  border: 1px solid #2a2f37;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  color: #e6e9ef;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  backdrop-filter: blur(6px);
}
.vault-graph-tooltip strong { font-weight: 600; }
.vault-graph-tooltip span { color: #9aa3b2; font-size: 11px; }

/* One-time interaction hint at the bottom of the frame */
.vault-graph-hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 3;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(20, 23, 28, 0.72);
  border: 1px solid #262b33;
  color: #8b93a3;
  font-size: 10.5px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0.9;
  transition: opacity 300ms;
}
.vault-graph-frame:hover .vault-graph-hint { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .vault-graph-canvas { animation: none; }
}

.vault-graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid #2a2a2a;
  background: #181818;
}
.vault-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #aaa;
}
.vault-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
}

/* Mobile / portrait — collapse to single pane, swipeable via toggles */
@media (max-width: 900px) {
  .vault-layout { grid-template-columns: 1fr; }
  .vault-resizer { display: none; }
  .vault-sidebar,
  .vault-graph-pane {
    position: absolute;
    inset: 49px 0 0 0;
    z-index: 5;
    background: #1a1a1a;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    border-right: 1px solid #2a2a2a;
    border-left: 0;
    width: min(320px, 90vw);
  }
  .vault-graph-pane {
    inset: 49px 0 0 auto;
    transform: translateX(100%);
    border-left: 1px solid #2a2a2a;
    border-right: 0;
  }
  .vault-shell.show-tree .vault-sidebar { transform: translateX(0); }
  .vault-shell.show-graph .vault-graph-pane { transform: translateX(0); }
  .vault-shell.show-tree .vault-note-pane,
  .vault-shell.show-graph .vault-note-pane { filter: brightness(0.6); }

  /* On phones the controls must not swallow the canvas: cap + scroll them, give
     the graph itself most of the height, and drop the legend to save space. */
  .vault-graph-pane { width: min(360px, 94vw); }
  .vault-graph-controls {
    max-height: 30vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 0 0 auto;
  }
  .vault-graph-frame { flex: 1 1 auto; min-height: 52vh; }
  .vault-graph-legend { display: none; }
}


/* ----- Vault: search, frontmatter, backlinks, zoomable graph ----- */
.vault-search {
  appearance: none;
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 8px;
  color: #dcddde;
  font-size: 12px;
  width: 130px;
  outline: none;
  transition: border-color 120ms, background 120ms;
}
.vault-search::placeholder { color: #666; }
.vault-search:focus { border-color: #7aa2f7; background: #2e2e2e; }

.vault-tree-row.is-hidden,
.vault-tree-file.is-hidden,
.vault-tree-dir.is-hidden { display: none !important; }
.vault-tree-dir.is-match-only > summary { color: #7aa2f7; }

.vault-icon-btn-sm {
  padding: 4px;
  margin-left: 2px;
}

.vault-pane-head {
  padding: 8px 12px;
}
.vault-tree-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.vault-tree-action-btn,
.vault-dir-action {
  appearance: none;
  border: 1px solid rgba(122, 162, 247, 0.35);
  background: rgba(31, 38, 58, 0.85);
  color: #d8e2ff;
  border-radius: 999px;
  cursor: pointer;
  font-size: 10px;
  line-height: 1.3;
  white-space: nowrap;
}
.vault-tree-action-btn { padding: 3px 8px; }
.vault-dir-action {
  padding: 0 7px;
  margin-left: auto;
  font-weight: 700;
}
.vault-tree-action-btn:hover,
.vault-dir-action:hover {
  background: rgba(55, 69, 104, 0.95);
  color: #fff;
}
.vault-tree-action-primary {
  border-color: rgba(224, 175, 104, 0.55);
  color: #f3e7c9;
}
.vault-tree-action-primary:hover {
  background: rgba(224, 175, 104, 0.2);
  color: #fff;
  border-color: rgba(224, 175, 104, 0.95);
}

.vault-sidebar > .vault-pane-head {
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  row-gap: 8px;
}
.vault-files-title-row {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.vault-files-title-row .vault-pane-title {
  padding: 0;
}
.vault-note-stats {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 6px;
}
.vault-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.25;
  border: 1px solid rgba(90, 90, 90, 0.55);
  background: rgba(40, 40, 40, 0.95);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.vault-stat-papers {
  border-color: rgba(122, 162, 247, 0.45);
  background: linear-gradient(180deg, rgba(45, 58, 88, 0.55) 0%, rgba(28, 32, 48, 0.92) 100%);
}
.vault-stat-patents {
  border-color: rgba(224, 175, 104, 0.5);
  background: linear-gradient(180deg, rgba(72, 58, 38, 0.5) 0%, rgba(32, 28, 22, 0.94) 100%);
}
.vault-stat-n {
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #e8ecf4;
}
.vault-stat-papers .vault-stat-n {
  color: #c8d9ff;
}
.vault-stat-patents .vault-stat-n {
  color: #f3e7c9;
}
.vault-stat-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(200, 200, 200, 0.72);
}
.vault-stat-papers .vault-stat-lbl {
  color: rgba(168, 192, 240, 0.75);
}
.vault-stat-patents .vault-stat-lbl {
  color: rgba(224, 200, 160, 0.78);
}
.vault-stat-documents {
  border-color: rgba(142, 192, 124, 0.45);
  background: linear-gradient(180deg, rgba(38, 52, 40, 0.55) 0%, rgba(22, 26, 22, 0.94) 100%);
}
.vault-stat-documents .vault-stat-n {
  color: #c5e8b8;
}
.vault-stat-documents .vault-stat-lbl {
  color: rgba(176, 214, 165, 0.82);
}
.vault-sidebar > .vault-pane-head .vault-pane-title {
  flex: 0 1 auto;
}
.vault-sidebar > .vault-pane-head .vault-tree-actions {
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 5px 6px;
  margin-left: 0 !important;
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
}
.vault-sidebar > .vault-pane-head .vault-search {
  flex: 1 1 100%;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.vault-tree-dir > summary {
  display: flex;
  align-items: center;
  gap: 6px;
}
.vault-inbox-queue {
  margin: 8px 8px 4px;
  padding: 8px;
  border: 1px solid rgba(224, 175, 104, 0.35);
  border-radius: 10px;
  background: rgba(224, 175, 104, 0.07);
}
.vault-inbox-queue-title {
  margin-bottom: 6px;
  color: #e0af68;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.vault-inbox-queue-item {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 4px 0;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(15, 18, 25, 0.65);
  color: #e8e8e8;
  cursor: pointer;
  text-align: left;
}
.vault-inbox-queue-item:hover { background: rgba(55, 69, 104, 0.55); }
.vault-inbox-queue-main {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vault-inbox-queue-meta {
  color: #e0af68;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.vault-note-meta {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
  margin-left: auto;
}

.vault-frontmatter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px clamp(18px, 4vw, 56px) 4px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.vault-fm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 2px clamp(18px, 4vw, 56px) 12px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  border-bottom: 1px solid transparent;
}
.vault-fm-actions-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #666;
  margin-right: 4px;
}
.vault-fm-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #2a2a2a;
  border: 1px solid #333;
  color: #b8b8b8;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.vault-fm-pill-key { color: #7aa2f7; opacity: 0.85; }
.vault-fm-pill-file {
  background: rgba(122, 162, 247, 0.08);
  border-color: rgba(122, 162, 247, 0.28);
  gap: 6px;
}
.vault-fm-pill-empty {
  background: rgba(224, 175, 104, 0.08);
  border-color: rgba(224, 175, 104, 0.35);
  color: rgba(224, 175, 104, 0.95);
}
.vault-fm-inline-btn {
  appearance: none;
  font: inherit;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #c8c8c8;
  cursor: pointer;
  line-height: 1.5;
}
.vault-fm-inline-btn:hover:not(:disabled) {
  background: rgba(224, 175, 104, 0.12);
  border-color: rgba(224, 175, 104, 0.55);
  color: #fff;
}
.vault-fm-inline-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.vault-fm-inline-btn-primary {
  background: rgba(224, 175, 104, 0.18);
  border-color: rgba(224, 175, 104, 0.55);
  color: rgba(224, 175, 104, 0.98);
  font-weight: 600;
}
.vault-fm-inline-btn-primary:hover:not(:disabled) {
  background: rgba(224, 175, 104, 0.28);
}

/* Inline indeterminate progress bar (curate / upload flow). */
.vault-fm-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 420px;
}
.vault-fm-progress[hidden] { display: none; }
.vault-fm-progress-track {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.vault-fm-progress-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: linear-gradient(
    90deg,
    rgba(224, 175, 104, 0) 0%,
    rgba(224, 175, 104, 0.85) 50%,
    rgba(224, 175, 104, 0) 100%
  );
  animation: vaultFmProgressSlide 1.6s ease-in-out infinite;
}
.vault-fm-progress-label {
  font-size: 11px;
  color: rgba(224, 175, 104, 0.95);
  white-space: nowrap;
}
@keyframes vaultFmProgressSlide {
  0%   { left: -40%; }
  100% { left: 100%; }
}
.vault-fm-pill-link,
.vault-asset-link,
.vault-open-file-link {
  color: #9cc0ff;
  text-decoration: none;
}
.vault-fm-pill-link:hover,
.vault-asset-link:hover,
.vault-open-file-link:hover {
  color: #fff;
  text-decoration: underline;
}
.vault-open-file-link {
  display: inline-flex;
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid rgba(122, 162, 247, 0.35);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.vault-backlinks {
  padding: 16px clamp(18px, 4vw, 56px) 80px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  border-top: 1px solid #2a2a2a;
}
.vault-backlinks-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin: 0 0 10px;
}
.vault-backlinks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

/* Markdown additions: tables (already have base), task lists, mark */
.vault-note-body ul.vault-tasks { list-style: none; padding-left: 8px; margin-left: 0; }
.vault-note-body li.vault-task { display: flex; align-items: flex-start; gap: 8px; }
.vault-note-body li.vault-task input[type="checkbox"] {
  margin-top: 4px; accent-color: #7aa2f7; pointer-events: none;
}



/* ---------- Vault graph: filter / display controls ---------- */
/* ----- Vault graph: filter / display controls ----- */
.vault-graph-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 6px 12px 10px;
  border-bottom: 1px solid #2a2a2a;
  font-size: 11px;
  color: #b8b8b8;
}
.vault-graph-section {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
}
.vault-graph-section > summary {
  cursor: pointer;
  padding: 6px 8px;
  color: #d7def5;
  font-weight: 600;
  user-select: none;
}
.vault-graph-section-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 0 8px 8px;
}
.vault-graph-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.vault-graph-toggle-row input[type="checkbox"] {
  margin: 0;
  accent-color: #7aa2f7;
}
.vault-graph-toggle-row input[type="range"] {
  accent-color: #7aa2f7;
  width: 70px;
}
.vault-graph-depth-value {
  min-width: 1ch;
  font-variant-numeric: tabular-nums;
  color: #7aa2f7;
}
.vault-graph-select {
  appearance: none;
  -webkit-appearance: none;
  background: #242833;
  color: #c9d4f2;
  border: 1px solid #333a47;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}
.vault-graph-category-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding-top: 2px;
}
.vault-graph-category-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7aa2f7;
}
.vault-graph-category-actions {
  display: flex;
  gap: 6px;
}
.vault-graph-category-action {
  appearance: none;
  border: 1px solid #333;
  background: #242424;
  color: #c9d4f2;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  cursor: pointer;
}
.vault-graph-category-action:hover { background: #303852; color: #fff; }
.vault-graph-category-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.vault-graph-category-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 0;
}
.vault-graph-category-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vault-graph-category-row input[type="checkbox"] {
  margin: 0;
  accent-color: #7aa2f7;
}
/* Compact round colour-picker swatch */
.vault-graph-category-color {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 120ms;
}
.vault-graph-category-color:hover { transform: scale(1.15); }
.vault-graph-category-color::-webkit-color-swatch-wrapper { padding: 0; }
.vault-graph-category-color::-webkit-color-swatch { border: none; border-radius: 50%; }
.vault-graph-category-color::-moz-color-swatch { border: none; border-radius: 50%; }
.vault-graph-category-count {
  color: #777;
  font-variant-numeric: tabular-nums;
}

/* Slider rows (Display / Forces) */
.vault-graph-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: #c9d0de;
}
.vault-graph-slider-row input[type="range"] {
  accent-color: #7aa2f7;
  width: 110px;
  justify-self: end;
}
.vault-graph-reset-forces {
  align-self: flex-start;
  margin-top: 2px;
}
