/* Phase 5.0: scope all overrides to the saved-human-path mode. */
body.exploration-viz .toolbar-row-primary > :not(#explorationToolbar),
body.exploration-viz .toolbar-row-secondary,
body.exploration-viz #mapLegend,
body.exploration-viz #summaryPills,
body.exploration-viz #workflowBanner {display:none!important;}
body.exploration-viz #explorationToolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
/* Keep select/zoom/refresh and the two layout actions in stable groups.
 * The group may wrap as a whole, but Reset and All Paths cannot split. */
body.exploration-viz .exploration-toolbar-cluster{display:inline-flex;align-items:center;gap:6px;flex-wrap:nowrap;min-width:0;}
body.exploration-viz .exploration-toolbar-cluster > .btn{flex:0 0 auto;}
body.exploration-viz .exploration-layout-actions{gap:8px;}
body.exploration-viz #explorationAllRoutes{white-space:nowrap;}
body.exploration-viz #explorationToolbar label{font-size:12px;color:var(--muted);}
body.exploration-viz #explorationSelect{max-width:min(360px,55vw);height:30px;color:var(--text);background:var(--panel);border:1px solid var(--line);border-radius:7px;}
body.exploration-viz .shell{grid-template-columns:minmax(0,1fr) var(--viz-sidebar-width);}
body.exploration-viz #detailPanel{display:block!important;overflow:auto;min-width:0;padding:16px;}
body.exploration-viz #detailPanel h2{font-size:16px;color:var(--cyan);overflow-wrap:anywhere;}
body.exploration-viz .exploration-edge{fill:none;stroke:#52d6c8;stroke-opacity:.78;cursor:pointer;}
body.exploration-viz .exploration-edge:hover{stroke:#ffa329;stroke-opacity:1;}
body.exploration-viz .exploration-edge-label{fill:#f5d190;font-size:12px;font-weight:600;text-anchor:middle;cursor:pointer;paint-order:stroke;stroke:#1f2126;stroke-width:4px;stroke-linejoin:round;}
body.exploration-viz .exploration-node{cursor:pointer;outline:none;}
body.exploration-viz .exploration-node circle{fill:#223845;stroke:#68b8e8;stroke-width:3px;}
body.exploration-viz .exploration-node circle.exploration-start{fill:#25474c;stroke:#52d6c8;}
body.exploration-viz .exploration-node circle.exploration-terminal{fill:#564022;stroke:#ffad45;stroke-width:4px;}
/* The focused document is visible even when it is also a start/end node. */
body.exploration-viz .exploration-node.exploration-focus-node circle{fill:#25545b;stroke:#fff;stroke-width:5px;}
body.exploration-viz .exploration-focus-label{font-size:11px;text-anchor:middle;fill:#94f5df;font-weight:700;paint-order:stroke;stroke:var(--bg);stroke-width:4px;}
body.exploration-viz .exploration-node:focus circle,body.exploration-viz .exploration-node:hover circle{stroke:#fff;}
body.exploration-viz .exploration-node-label{font-size:12px;text-anchor:middle;fill:var(--text);paint-order:stroke;stroke:var(--bg);stroke-width:5px;stroke-linejoin:round;}
body.exploration-viz .exploration-node-count{text-anchor:middle;fill:#d4e9f0;font-size:11px;font-weight:700;paint-order:stroke;stroke:var(--bg);stroke-width:4px;}
body.exploration-viz .exploration-detail-line{display:flex;flex-direction:column;gap:3px;border-bottom:1px solid var(--line);padding:9px 0;font-size:12px;overflow-wrap:anywhere;white-space:pre-wrap;}
body.exploration-viz .exploration-detail-line strong{color:var(--muted);}
body.exploration-viz .exploration-help{font-size:12px;line-height:1.65;color:var(--muted);}
body.exploration-viz .exploration-warning{font-size:12px;color:#ffad45;line-height:1.6;}
body.exploration-viz .exploration-route-entry{display:block;text-align:left;width:100%;padding:10px 6px;margin:6px 0;color:var(--text);background:var(--panel);border:1px solid var(--line);border-radius:5px;cursor:pointer;overflow-wrap:anywhere;}
body.exploration-viz .exploration-route-entry:hover{border-color:var(--cyan);}
body.exploration-viz .exploration-open{margin-top:12px;min-height:34px;}
@media(max-width:850px){body.exploration-viz .shell{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) minmax(160px,35vh);}body.exploration-viz #detailPanel{grid-row:2;}body.exploration-viz .detail-panel-resizer{display:none;}}

/* Phase 5.2: one interactive badge per ordered pair; on-demand route popup. */
body.exploration-viz .exploration-edge-badge{cursor:pointer;outline:none;}
body.exploration-viz .exploration-edge-badge rect{fill:#233a3d;stroke:#52d6c8;stroke-width:1.6px;}
body.exploration-viz .exploration-edge-badge:hover rect,
body.exploration-viz .exploration-edge-badge:focus rect{stroke:#ffad45;stroke-width:2.5px;}
body.exploration-viz .exploration-edge-badge .exploration-edge-label{font-size:11px;stroke:none;pointer-events:none;}
.exploration-edge-popup{position:fixed;z-index:2000;width:min(350px,calc(100vw - 16px));max-height:min(440px,calc(100vh - 16px));overflow:auto;background:#222a2e;color:#f5f7f8;border:1px solid #52d6c8;border-radius:11px;padding:13px;box-shadow:0 12px 30px #000a;font-size:12px;line-height:1.55;}
.exploration-popup-header{display:flex;justify-content:space-between;align-items:center;gap:8px;}
.exploration-popup-header strong{font-size:14px;color:#a4f8e8;}
.exploration-popup-close{background:transparent;color:#e1e8e9;border:1px solid #748a8b;border-radius:5px;padding:4px 7px;cursor:pointer;}
.exploration-popup-pair{padding:8px 0;overflow-wrap:anywhere;border-bottom:1px solid #45575a;}
.exploration-popup-tags{display:flex;gap:6px;flex-wrap:wrap;padding:10px 0;}
.exploration-popup-tag{display:inline-block;padding:3px 8px;color:#f9d493;background:#403524;border:1px solid #b48033;border-radius:999px;overflow-wrap:anywhere;}
.exploration-popup-caption{font-size:11px;color:#aebec0;margin:4px 0 6px;}
.exploration-popup-routes{display:grid;gap:6px;}
.exploration-popup-route{display:block;text-align:left;overflow-wrap:anywhere;color:#f1f7f7;background:#314047;border:1px solid #55676b;border-radius:6px;padding:8px;cursor:pointer;}
.exploration-popup-route:hover,.exploration-popup-route:focus{border-color:#ffad45;}

/* Network-only overview. The Tree UI and styles have been retired. */
body.exploration-viz #explorationZoomValue{font-size:12px;min-width:45px;text-align:center;color:#c8f3e9;}
body.exploration-viz #explorationZoomIn,body.exploration-viz #explorationZoomOut{min-width:32px;}
body.exploration-viz .graph-wrap{position:relative;min-width:0;}
body.exploration-viz #explorationNetworkLegend{position:absolute;bottom:12px;left:12px;display:flex;gap:7px;flex-wrap:wrap;max-width:calc(100% - 32px);padding:8px 12px;color:#cadfdf;background:#1b2428ed;border:1px solid #495c61;border-radius:9px;font-size:11px;pointer-events:none;}
body.exploration-viz #explorationNetworkLegend strong{color:#83e6db;}

/* Only report DB errors; routine save/restore statuses cluttered the toolbar. */
body.exploration-viz #explorationResetLayout{white-space:nowrap;border-color:#5c7177;}
body.exploration-viz #explorationLayoutStatus{font-size:11px;color:#ffad45;max-width:240px;line-height:1.25;}
body.exploration-viz #explorationLayoutStatus[hidden]{display:none!important;}

/* Phase 5.9: reuse the legacy shell's existing toggle and resize handle,
 * but scope the override STRICTLY to saved-exploration mode. */
body.exploration-viz #detailPanelToggleBtn {display:flex!important;}
body.exploration-viz .shell.detail-collapsed {grid-template-columns:minmax(0,1fr) 0;}
body.exploration-viz .shell.detail-collapsed #detailPanel {
  padding:0;visibility:hidden;pointer-events:none;overflow:hidden;
}
body.exploration-viz .shell.detail-collapsed .detail-panel-resizer {display:none;}
body.exploration-viz .exploration-route-leg {stroke-width:1.5px;stroke-opacity:.9;}
@media(max-width:850px) {
  body.exploration-viz .shell.detail-collapsed {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:minmax(0,1fr) 0;
  }
  body.exploration-viz #detailPanelToggleBtn {
    right:10px;top:auto;bottom:14px;transform:none;
  }
  body.exploration-viz .detail-panel-resizer {display:none;}
}

/* Phase 5.6 — minimal human-path network; reserve separate styling for
 * future tag-link overlays. These rules apply ONLY to exploration mode. */
body.exploration-viz .exploration-node circle,
body.exploration-viz .exploration-node circle.exploration-start,
body.exploration-viz .exploration-node circle.exploration-terminal,
body.exploration-viz .exploration-node circle.exploration-document {
  fill:#08c9cb;stroke:#53dfe1;stroke-width:1.4px;
}
/* Phase 5.9: the white border is a CLICK selection, never hover or
 * implicit current-file emphasis. The file-focus text label is retained. */
body.exploration-viz .exploration-node.exploration-focus-node circle {fill:#08c9cb;stroke:#53dfe1;stroke-width:1.4px;}
body.exploration-viz .exploration-node:hover circle {stroke:#53dfe1;stroke-width:1.4px;}
body.exploration-viz .exploration-node:focus-visible:not(.exploration-selected-document) circle {stroke:#97f3f2;stroke-width:1.8px;}
body.exploration-viz .exploration-node.exploration-selected-document circle,
body.exploration-viz .exploration-node.exploration-selected-document:hover circle,
body.exploration-viz .exploration-node.exploration-selected-document:focus-visible circle {
  fill:#08c9cb;stroke:#fff;stroke-width:2.6px;
}
body.exploration-viz .exploration-node-label {font-size:11px;stroke-width:3px;}
body.exploration-viz .exploration-focus-label {font-size:10px;stroke-width:2px;}
body.exploration-viz .exploration-edge {
  fill:none;stroke:#e1b87b;stroke-width:1.5px;stroke-opacity:.78;pointer-events:none;
}
body.exploration-viz .exploration-edge-hit {
  fill:none;stroke:transparent;stroke-width:17px;cursor:pointer;pointer-events:stroke;
}
body.exploration-viz .exploration-link:hover .exploration-edge,
body.exploration-viz .exploration-link:focus-within .exploration-edge {
  stroke:#f4cf91;stroke-width:2px;stroke-opacity:1;
}
/* Labels appear on intent, not on every link in a whole-project overlay. */
body.exploration-viz .exploration-link .exploration-edge-badge {
  opacity:0;pointer-events:none;transition:opacity .1s ease;
}
body.exploration-viz .exploration-link:hover .exploration-edge-badge,
body.exploration-viz .exploration-link:focus-within .exploration-edge-badge {
  opacity:1;pointer-events:auto;
}
body.exploration-viz .exploration-edge-badge rect {
  fill:#3c3329;stroke:#d4a96d;stroke-width:1px;
}
body.exploration-viz .exploration-edge-badge .exploration-edge-label {
  font-size:10px;fill:#f0d1a1;
}
/* A same-document hop is an unobtrusive clickable dot beside the file. */
body.exploration-viz .exploration-loop-badge {cursor:pointer;outline:none;}
body.exploration-viz .exploration-loop-hit {fill:transparent;stroke:none;}
body.exploration-viz .exploration-loop-dot {fill:#e1b87b;stroke:#483a28;stroke-width:1px;}
body.exploration-viz .exploration-loop-badge:hover .exploration-loop-dot,
body.exploration-viz .exploration-loop-badge:focus-visible .exploration-loop-dot {
  fill:#fff0d0;stroke:#e1b87b;stroke-width:2px;
}
body.exploration-viz #explorationNetworkLegend {
  gap:9px;padding:5px 9px;font-size:10px;opacity:.87;
}
body.exploration-viz #explorationNetworkLegend strong {color:#e7c18a;}

/* Phase 5.7: bipartite document/search-term presentation ONLY.
 * The legacy tag-link map keeps all of its original styles. */
body.exploration-viz .exploration-route-node {cursor:grab;outline:none;}
body.exploration-viz .exploration-route-node:active {cursor:grabbing;}
body.exploration-viz .exploration-route-pill {
  fill:#44372a;stroke:#e1b87b;stroke-width:1.1px;
}
body.exploration-viz .exploration-route-word {
  fill:#f0d1a1;font-size:11px;font-weight:600;pointer-events:none;
}
body.exploration-viz .exploration-route-node:hover .exploration-route-pill,
body.exploration-viz .exploration-route-node:focus-visible .exploration-route-pill {
  stroke:#fff0d0;stroke-width:2px;
}
body.exploration-viz .exploration-route-leg {
  fill:none;stroke:#e1b87b;stroke-width:1.3px;stroke-opacity:.8;pointer-events:none;
}
body.exploration-viz .exploration-route-link:hover .exploration-route-leg {stroke:#f0d1a1;}
body.exploration-viz .exploration-terms-only .exploration-popup-tags {padding-bottom:0;}

/* Phase 5.8: dim only unrelated SAVED paths when a human keyword is clicked.
 * Dimmed items remain visible and clickable; overlapping/shared documents
 * stay bright when they belong to at least one selected saved exploration.
 * These rules never affect the legacy tag-link visualization. */
body.exploration-viz .exploration-route-link.exploration-route-dimmed,
body.exploration-viz .exploration-route-node.exploration-route-dimmed {
  opacity: .13;
}
body.exploration-viz .exploration-node.exploration-document-dimmed {
  opacity: .22;
}
body.exploration-viz .exploration-route-link.exploration-route-selected .exploration-route-leg {
  stroke:#f6d6a8; stroke-opacity:1; stroke-width:1.8px;
}
body.exploration-viz .exploration-route-node.exploration-route-selected .exploration-route-pill {
  stroke:#fff0d0; stroke-width:1.8px;
}
/* v1.9: network-only view and compact, timestamp-free route list. */
body.exploration-viz .exploration-route-entry{display:flex;flex-direction:column;align-items:stretch;gap:5px;padding:10px 12px;}
body.exploration-viz .exploration-route-file{display:block;white-space:normal;overflow-wrap:anywhere;font-size:13px;line-height:1.35;}
body.exploration-viz .exploration-route-arrow{display:block;text-align:center;color:var(--cyan);font-size:15px;line-height:1;}
body.exploration-viz .exploration-route-pair{display:flex;flex-direction:column;align-items:stretch;gap:3px;padding:3px 0 8px;}
body.exploration-viz .exploration-route-pair+.exploration-route-pair{border-top:1px solid var(--line);padding-top:9px;}

/* v1.9.2: document node detail = thumbnail + saved AI summary only. */
body.exploration-viz .exploration-preview-image-area {
  display:flex;align-items:center;justify-content:center;min-height:170px;
  margin:12px 0 20px;padding:8px;overflow:hidden;
  background:#20262c;border:1px solid #46565c;border-radius:10px;
  color:var(--muted);font-size:12px;
}
body.exploration-viz .exploration-preview-thumbnail {
  display:block;width:100%;height:auto;max-height:46vh;object-fit:contain;
  cursor:pointer;border-radius:5px;
}
body.exploration-viz .exploration-preview-thumbnail:focus-visible {outline:2px solid var(--cyan);outline-offset:3px;}
body.exploration-viz .exploration-preview-heading {
  font-size:13px;letter-spacing:.04em;color:var(--cyan);margin:4px 0 8px;
}
body.exploration-viz .exploration-preview-summary {
  white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;font-size:13px;
  color:var(--text);margin:0 0 18px;
}

/* Human-saved search hop details. No inferred source/target positions. */
body.exploration-viz .exploration-disconnect-caption{font-size:12px;line-height:1.6;color:var(--muted);}
body.exploration-viz .exploration-disconnect-group{margin:12px 0 18px;padding:10px;border:1px solid var(--line);border-radius:10px;background:rgba(0,0,0,.08);overflow-wrap:anywhere;}
body.exploration-viz .exploration-disconnect-group>h3{font-size:12px;color:var(--cyan);line-height:1.6;}
body.exploration-viz .exploration-disconnect-endpoint{padding:9px 3px;line-height:1.6;font-size:12px;}
body.exploration-viz .exploration-disconnect-endpoint h3{color:var(--cyan);font-size:13px;margin:0 0 5px;}
body.exploration-viz .exploration-disconnect-endpoint strong{display:block;overflow-wrap:anywhere;}
body.exploration-viz .exploration-disconnect-position{margin-top:6px;color:var(--muted);}
body.exploration-viz .exploration-disconnect-excerpt{margin:7px 0;padding:9px;background:rgba(0,0,0,.14);border-left:2px solid var(--cyan);white-space:pre-wrap;overflow-wrap:anywhere;}
body.exploration-viz .exploration-disconnect-open{border:1px solid var(--cyan);background:transparent;color:var(--cyan);padding:6px 10px;border-radius:7px;cursor:pointer;font:inherit;font-size:11px;}
body.exploration-viz .exploration-disconnect-key{text-align:center;color:var(--muted);font-size:11px;}
body.exploration-viz .exploration-disconnect-query{text-align:center;padding:9px;color:#fff;font-weight:700;font-size:13px;overflow-wrap:anywhere;}
body.exploration-viz .exploration-disconnect-arrow{text-align:center;color:#69a8ff;}
body.exploration-viz .exploration-disconnect-button{display:block;width:100%;min-height:40px;margin:12px 0 20px;border:1px solid #e66d6d;border-radius:9px;background:rgba(224,80,80,.12);color:#ffaaaa;font:inherit;font-weight:700;cursor:pointer;}
body.exploration-viz .exploration-disconnect-button:hover{background:rgba(224,80,80,.25);}
body.exploration-viz .exploration-disconnect-button:disabled{opacity:.45;cursor:wait;}
