/* ============================================================
   Node Links Modal
   ============================================================ */
.node-links-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 115;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem;
}
.node-links-modal-panel {
    width: min(720px, 100%);
    max-height: min(92vh, 900px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 0.75rem;
    box-shadow: 0 24px 70px -24px rgba(15, 23, 42, 0.38);
}
.node-links-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    flex-shrink: 0;
    padding: 0.75rem 0.9rem 0.6rem;
    border-bottom: 1px solid #e2e8f0;
}
.node-links-modal-header-copy {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}
.node-links-modal-icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.95rem;
}
.node-links-modal-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}
.node-links-modal-subtitle {
    margin-top: 0.12rem;
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.3;
}
.node-links-modal-close {
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s ease;
}
.node-links-modal-close:hover {
    color: #334155;
}
.node-links-modal-status {
    font-size: 0.76rem;
    font-weight: 500;
    flex-shrink: 0;
    margin: 0 0.85rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.45rem;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}
.node-links-modal-status-error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}
.node-links-modal-body {
    padding: 0.6rem 0.85rem 0.75rem;
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    /* Align “Add link” grid with existing rows (label / URL / scope columns) */
    --nl-drag: 1.6rem;
    --nl-label: 14rem;
    --nl-url-max: 9rem;
    --nl-scope: 8.75rem;
    --nl-grid-gap: 0.32rem;
}
.node-links-modal-loading,
.node-links-empty-state,
.node-links-feedback {
    font-size: 0.8rem;
    color: #64748b;
}
.node-links-feedback-error,
.node-links-row-feedback-error {
    color: #b91c1c;
}
.node-links-section {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.node-links-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #64748b;
    padding-left: 0.5rem;
    line-height: 1.2;
}
.node-links-editor-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.node-links-editor-row {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #f8fafc;
    padding: 0.3rem 0.5rem;
    transition: opacity 0.15s, border-color 0.15s;
    position: relative;
}
.node-links-create-form {
    border: 1px solid #e2e8f0;
    border-radius: 0.55rem;
    background: #f8fafc;
    /* Match `.node-links-editor-row` horizontal inset so columns line up across sections */
    padding: 0.3rem 0.5rem;
}
.node-links-editor-row-inner {
    display: grid;
    grid-template-columns:
        var(--nl-drag)
        var(--nl-label)
        minmax(0, var(--nl-url-max))
        var(--nl-scope)
        auto;
    gap: var(--nl-grid-gap);
    align-items: center;
}
.node-links-editor-grid {
    display: grid;
    grid-template-columns:
        var(--nl-drag)
        var(--nl-label)
        minmax(0, var(--nl-url-max))
        var(--nl-scope)
        auto;
    gap: var(--nl-grid-gap);
    align-items: center;
}
.node-links-editor-grid .node-links-save-btn {
    justify-self: end;
    white-space: nowrap;
    padding: 0.22rem 0.55rem;
    font-size: 0.74rem;
    border-radius: 0.45rem;
}
.node-links-grid-spacer {
    display: block;
    width: 100%;
    min-height: 1px;
    pointer-events: none;
}
.node-links-input-label,
.node-links-input-url {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.node-links-editor-grid .node-links-select-inline,
.node-links-editor-row-inner .node-links-select-inline {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.node-links-editor-row-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: flex-end;
    justify-self: end;
}
.node-links-drag-handle {
    flex-shrink: 0;
    justify-self: center;
    cursor: grab;
    color: #94a3b8;
    background: transparent;
    border: none;
    padding: 0.05rem 0.1rem;
    font-size: 0.9rem;
    line-height: 1;
    transition: color 0.15s;
    touch-action: none;
    display: flex;
    align-items: center;
}
.node-links-drag-handle:hover {
    color: #475569;
}
.node-links-drag-handle:active {
    cursor: grabbing;
}
.node-links-row-dragging {
    opacity: 0.35;
}
.node-links-drop-before {
    border-top: 2px solid #2563eb;
}
.node-links-drop-after {
    border-bottom: 2px solid #2563eb;
}
.node-links-dnd-ghost {
    background: #1e40af;
    color: #ffffff;
    border-radius: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
    pointer-events: none;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.node-links-input,
.node-links-select {
    min-width: 0;
    background: #ffffff;
}
.node-links-row-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    justify-content: flex-end;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.node-links-editor-row .node-links-save-btn {
    padding: 0.22rem 0.55rem;
    font-size: 0.74rem;
    border-radius: 0.45rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.node-links-editor-row .node-links-delete-btn {
    flex-shrink: 0;
}
.node-links-scope-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.68rem;
    padding: 0.12rem 0.45rem;
}
.node-links-save-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    cursor: pointer;
}
.node-links-save-btn:hover {
    background: #1d4ed8;
}
.node-links-delete-btn {
    border: none;
    background: transparent;
    color: #ef4444;
    font-size: 0.74rem;
    cursor: pointer;
    padding: 0.22rem 0.15rem;
}
.node-links-delete-btn:hover {
    color: #dc2626;
}
.node-links-row-feedback {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: #64748b;
}
.node-links-readonly-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.node-links-readonly-link {
    font-size: 0.82rem;
    color: #0f172a;
    text-decoration: none;
}
.node-links-readonly-link:hover {
    text-decoration: underline;
}
.node-links-readonly-meta {
    font-size: 0.72rem;
    color: #64748b;
}
