/* ====================================================================
 * Graph view + filter rail.  Tokens come from #page-notes (notes.css).
 * Match notes.css naming: .ng- = "notes graph".
 * ==================================================================== */

#page-notes .ng-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: var(--bg-0);
}

#page-notes .ng-toolbar {
    height: 44px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: var(--bg-1);
}
#page-notes .ng-toolbar-icon {
    color: var(--accent);
    font-size: 14px;
}
#page-notes .ng-toolbar-title {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: var(--text-primary);
    text-transform: uppercase;
}
#page-notes .ng-toolbar-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}
#page-notes .ng-toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
#page-notes .ng-toolbar-search {
    width: 200px;
    padding: 5px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 12px;
}
#page-notes .ng-toolbar-search:focus {
    outline: none;
    border-color: var(--accent);
}

#page-notes .ng-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
    background:
        linear-gradient(rgba(58, 66, 80, 0.15) 1px, transparent 1px) 0 0 / 40px 40px,
        linear-gradient(90deg, rgba(58, 66, 80, 0.15) 1px, transparent 1px) 0 0 / 40px 40px,
        var(--bg-0);
}

#page-notes .ng-svg {
    width: 100%;
    height: 100%;
    display: block;
}
#page-notes .ng-node:hover {
    stroke: var(--text-primary);
    stroke-width: 2;
    filter: brightness(1.15);
}

/* ── Hover card (top-right of stage) ──────────────────────── */

#page-notes .ng-hover-card {
    position: absolute;
    top: 16px;
    right: 248px;
    width: 240px;
    padding: 12px 14px;
    background: var(--surface-elev);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 5;
}
#page-notes .ng-hc-folder {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-bottom: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
#page-notes .ng-hc-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.25;
}
#page-notes .ng-hc-stats {
    display: flex;
    gap: 14px;
    margin-bottom: 8px;
}
#page-notes .ng-hc-stats > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#page-notes .ng-hc-num {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
#page-notes .ng-hc-num.muted {
    color: var(--text-muted);
}
#page-notes .ng-hc-num-l {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}
#page-notes .ng-hc-excerpt {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 8px;
}
#page-notes .ng-hc-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
#page-notes .ng-hc-tags span {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 1px 6px;
    background: rgba(79, 195, 247, 0.1);
    color: var(--accent);
    border-radius: 2px;
}

/* ── Filter rail (top-right) ──────────────────────────────── */

#page-notes .ng-filters {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 220px;
    padding: 12px;
    background: rgba(15, 19, 26, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 6px;
    z-index: 4;
}
#page-notes .ng-filt-head {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}
#page-notes .ng-filt-head-2 {
    margin-top: 4px;
}
#page-notes .ng-filt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}
#page-notes .ng-filt-row input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    margin: 0;
}
#page-notes .ng-filt-lbl {
    flex: 1;
}
#page-notes .ng-filt-cnt {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}
#page-notes .ng-filt-sep {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}
#page-notes .ng-filt-slider-row {
    padding: 4px 0;
}
#page-notes .ng-filt-slider-head {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
#page-notes .ng-filt-slider-val {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}
#page-notes .ng-filt-slider {
    width: 100%;
    height: 4px;
    accent-color: var(--accent);
    appearance: none;
    background: var(--surface);
    border-radius: 2px;
    cursor: pointer;
}
#page-notes .ng-filt-slider:focus { outline: none; }

/* ── Legend (bottom-left) ─────────────────────────────────── */

#page-notes .ng-legend {
    position: absolute;
    bottom: 16px;
    left: 16px;
    padding: 10px 14px;
    background: rgba(15, 19, 26, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 3;
}
#page-notes .ng-legend-head {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}
#page-notes .ng-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
#page-notes .ng-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Empty / error state ──────────────────────────────────── */

#page-notes .ng-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    pointer-events: none;
}
#page-notes .ng-empty-glyph {
    font-size: 36px;
    color: var(--accent);
    opacity: 0.6;
    margin-bottom: 4px;
}
#page-notes .ng-empty-title {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--text-primary);
}
#page-notes .ng-empty-body {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 360px;
    text-align: center;
}
#page-notes .ng-empty-detail {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--bad);
    max-width: 540px;
    text-align: center;
    word-break: break-word;
}

/* ── Responsive: collapse filters on narrow screens ───────── */

@media (max-width: 1100px) {
    #page-notes .ng-filters,
    #page-notes .ng-hover-card { right: 12px; }
}
@media (max-width: 820px) {
    #page-notes .ng-filters {
        right: 12px;
        top: 60px;
        width: 180px;
    }
    #page-notes .ng-hover-card {
        right: auto; left: 12px; bottom: 12px; top: auto;
    }
}
